libonion
|
Basic information about a request. More...
#include <types.h>
Public Member Functions | |
onion_request * | onion_request_new (onion_listen_point *op) |
Creates a request object. | |
static void | unlink_files (void *p, const char *key, const char *value, int flags) |
Helper to remove temporal files from req->files. | |
void | onion_request_free (onion_request *req) |
Deletes a request and all its data. | |
void | onion_request_clean (onion_request *req) |
Cleans a request object to reuse it. | |
const char * | onion_request_get_path (onion_request *req) |
Returns a pointer to the string with the current path. Its a const and should not be trusted for long time. | |
const char * | onion_request_get_fullpath (onion_request *req) |
Returns a pointer to the string with the full path. Its a const and should not be trusted for long time. | |
onion_request_flags | onion_request_get_flags (onion_request *req) |
Gets the current flags, as in onion_request_flags_e. | |
void | onion_request_advance_path (onion_request *req, off_t addtopos) |
Moves the pointer inside fullpath to this new position, relative to current path. | |
const char * | onion_request_get_header (onion_request *req, const char *header) |
Gets a header data. | |
const char * | onion_request_get_query (onion_request *req, const char *query) |
Gets a query data. | |
const char * | onion_request_get_queryd (onion_request *req, const char *key, const char *def) |
Gets a query data, but has a default value if the key is not there. | |
const char * | onion_request_get_post (onion_request *req, const char *query) |
Gets a post data. | |
const char * | onion_request_get_file (onion_request *req, const char *query) |
Gets file data. | |
const char * | onion_request_get_session (onion_request *req, const char *key) |
Gets session data. | |
const onion_dict * | onion_request_get_header_dict (onion_request *req) |
Gets the header header data dict. | |
const onion_dict * | onion_request_get_query_dict (onion_request *req) |
Gets request query dict. | |
const onion_dict * | onion_request_get_post_dict (onion_request *req) |
Gets post data dict. | |
const onion_dict * | onion_request_get_file_dict (onion_request *req) |
Gets files data dict. | |
void | onion_request_guess_session_id (onion_request *req) |
Gets the sessionid cookie, if any, and sets it to req->session_id. | |
onion_dict * | onion_request_get_session_dict (onion_request *req) |
Returns the session dict. | |
void | onion_request_set_no_keep_alive (onion_request *req) |
Forces the request to process only one request, not doing the keep alive. | |
int | onion_request_keep_alive (onion_request *req) |
Returns if current request wants to keep alive. | |
void | onion_request_session_free (onion_request *req) |
Frees the session dictionary. | |
const char * | onion_request_get_language_code (onion_request *req) |
Returns the language code of the current request. | |
const onion_block * | onion_request_get_data (onion_request *req) |
Some extra data, normally when the petition is propfind or POST with non-form data. | |
void | onion_request_polish (onion_request *req) |
Performs the final touches do the request is ready to be handled. | |
const char * | onion_request_get_client_description (onion_request *req) |
Returns a string with the client's description. | |
struct sockaddr_storage * | onion_request_get_sockadd_storage (onion_request *req, socklen_t *client_len) |
Returns the sockaddr_storage pointer to the data client data as stored here. | |
onion_dict * | onion_request_get_cookies_dict (onion_request *req) |
Gets the dict with the cookies. | |
const char * | onion_request_get_cookie (onion_request *req, const char *cookiename) |
Gets a Cookie value by name. |
Data Fields | |
const char * | onion_request_methods [16] |
struct { | |
onion_listen_point * listen_point | |
void * user_data | |
int fd | |
Original fd, to use at polling. | |
struct sockaddr_storage cli_addr | |
socklen_t cli_len | |
char * cli_info | |
} | connection |
int | flags |
Connection to the client. | |
char * | fullpath |
Flags for this response. Ored onion_request_flags_e. | |
char * | path |
Original path for the request. | |
onion_dict * | headers |
Path at this level. Its actually a pointer inside fullpath, removing the leading parts already processed by handlers. | |
onion_dict * | GET |
Headers prepared for this response. | |
onion_dict * | POST |
When the query (?q=query) is processed, the dict with the values. | |
onion_dict * | FILES |
Dictionary with POST values. | |
onion_dict * | session |
Dictionary with files. They are automatically saved at /tmp/ and removed at request free. mapped string is full path. | |
onion_block * | data |
Pointer to related session. | |
onion_dict * | cookies |
Some extra data from PUT, normally PROPFIND. | |
char * | session_id |
Data about cookies. | |
void * | parser |
Session id of the request, if any. | |
void * | parser_data |
When recieving data, where to put it. Check at request_parser.c. | |
onion_websocket * | websocket |
Data necesary while parsing, muy be deleted when state changed. At free is simply freed. | |
onion_ptr_list * | free_list |
Websocket handler. |
Basic information about a request.
struct sockaddr_storage onion_request_t::cli_addr |
char* onion_request_t::cli_info |
Referenced by onion_request_clean(), onion_request_free(), and onion_request_get_client_description().
socklen_t onion_request_t::cli_len |
struct { ... } onion_request_t::connection |
Referenced by onion_http_t::onion_http_read(), onion_http_t::onion_http_read_ready(), onion_http_t::onion_http_write(), onion_https_t::onion_https_close(), onion_https_t::onion_https_read(), onion_https_t::onion_https_request_init(), onion_https_t::onion_https_write(), onion_listen(), onion_listen_point_t::onion_listen_point_accept(), onion_listen_point_t::onion_listen_point_read_ready(), onion_listen_point_t::onion_listen_point_request_close_socket(), onion_listen_point_t::onion_listen_point_request_init_from_socket(), onion_request_clean(), onion_request_free(), onion_request_get_client_description(), onion_request_get_session_dict(), onion_request_get_sockadd_storage(), onion_request_guess_session_id(), onion_request_is_secure(), onion_request_new(), onion_request_new_from_socket(), onion_request_process(), onion_request_session_free(), onion_response_flush(), onion_response_t::onion_response_free(), onion_shortcut_internal_redirect(), onion_shortcut_response_file(), onion_websocket_t::onion_websocket_call(), onion_websocket_t::onion_websocket_read(), and onion_websocket_t::onion_websocket_write().
onion_dict* onion_request_t::cookies |
Some extra data from PUT, normally PROPFIND.
Referenced by onion_request_clean(), onion_request_free(), and onion_request_get_cookies_dict().
onion_block* onion_request_t::data |
Pointer to related session.
Referenced by onion_request_clean(), onion_request_free(), onion_request_get_data(), and onion_websocket_t::onion_websocket_new().
int onion_request_t::fd |
Original fd, to use at polling.
Referenced by onion_http_t::onion_http_read(), onion_http_t::onion_http_write(), onion_https_t::onion_https_request_init(), onion_listen_point_t::onion_listen_point_accept(), onion_listen_point_t::onion_listen_point_request_close_socket(), onion_listen_point_t::onion_listen_point_request_init_from_socket(), onion_request_new(), onion_request_new_from_socket(), onion_request_process(), onion_shortcut_response_file(), and onion_websocket_t::onion_websocket_call().
onion_dict* onion_request_t::FILES |
Dictionary with POST values.
Referenced by onion_request_clean(), onion_request_free(), onion_request_get_file(), and onion_request_get_file_dict().
int onion_request_t::flags |
Connection to the client.
Referenced by onion_request_clean(), onion_request_get_flags(), onion_request_get_session_dict(), onion_request_keep_alive(), onion_request_process(), onion_request_set_no_keep_alive(), onion_response_t::onion_response_free(), and onion_response_t::onion_response_write_headers().
onion_ptr_list* onion_request_t::free_list |
Websocket handler.
Referenced by onion_request_clean(), and onion_request_free().
char* onion_request_t::fullpath |
Flags for this response. Ored onion_request_flags_e.
Referenced by onion_request_advance_path(), onion_request_clean(), onion_request_free(), onion_request_get_fullpath(), onion_request_polish(), onion_response_t::onion_response_free(), and onion_shortcut_internal_redirect().
onion_dict* onion_request_t::GET |
Headers prepared for this response.
Referenced by onion_request_clean(), onion_request_free(), onion_request_get_query(), onion_request_get_query_dict(), and onion_url_handler().
onion_dict* onion_request_t::headers |
Path at this level. Its actually a pointer inside fullpath, removing the leading parts already processed by handlers.
Referenced by onion_request_clean(), onion_request_free(), onion_request_get_header(), onion_request_get_header_dict(), onion_request_get_language_code(), onion_request_guess_session_id(), and onion_request_new().
onion_listen_point* onion_request_t::listen_point |
Referenced by onion_http_t::onion_http_read_ready(), onion_https_t::onion_https_request_init(), onion_listen(), onion_listen_point_t::onion_listen_point_accept(), onion_listen_point_t::onion_listen_point_read_ready(), onion_listen_point_t::onion_listen_point_request_init_from_socket(), onion_request_clean(), onion_request_free(), onion_request_get_session_dict(), onion_request_guess_session_id(), onion_request_is_secure(), onion_request_new(), onion_request_process(), onion_request_session_free(), onion_response_flush(), onion_response_t::onion_response_free(), onion_shortcut_internal_redirect(), onion_shortcut_response_file(), onion_websocket_t::onion_websocket_read(), and onion_websocket_t::onion_websocket_write().
void* onion_request_t::parser |
Session id of the request, if any.
Referenced by onion_request_write().
void* onion_request_t::parser_data |
When recieving data, where to put it. Check at request_parser.c.
Referenced by onion_request_clean(), onion_request_free(), and onion_request_write().
char* onion_request_t::path |
Original path for the request.
Referenced by onion_request_advance_path(), onion_request_clean(), onion_request_get_path(), onion_request_polish(), onion_request_process(), and onion_shortcut_internal_redirect().
onion_dict* onion_request_t::POST |
When the query (?q=query) is processed, the dict with the values.
Referenced by onion_request_clean(), onion_request_free(), onion_request_get_post(), and onion_request_get_post_dict().
onion_dict* onion_request_t::session |
Dictionary with files. They are automatically saved at /tmp/ and removed at request free. mapped string is full path.
Referenced by onion_request_clean(), onion_request_free(), onion_request_get_session_dict(), onion_request_guess_session_id(), onion_request_session_free(), and onion_response_t::onion_response_write_headers().
char* onion_request_t::session_id |
Data about cookies.
Referenced by onion_request_clean(), onion_request_free(), onion_request_get_session_dict(), onion_request_guess_session_id(), onion_request_session_free(), and onion_response_t::onion_response_write_headers().
void* onion_request_t::user_data |
onion_websocket* onion_request_t::websocket |
Data necesary while parsing, muy be deleted when state changed. At free is simply freed.
Referenced by onion_handler_t::onion_handler_handle(), onion_request_free(), onion_websocket_t::onion_websocket_free(), and onion_websocket_t::onion_websocket_new().