|
libonion
|
Typedefs | |
| typedef enum onion_request_flags_e | onion_request_flags |
Enumerations | |
| enum | onion_request_flags_e { OR_METHODS = 0x0F, OR_GET = 0, OR_POST = 1, OR_HEAD = 2, OR_OPTIONS = 3, OR_PROPFIND = 4, OR_PUT = 5, OR_DELETE = 6, OR_MOVE = 7, OR_MKCOL = 8, OR_PROPPATCH = 9, OR_PATCH = 10, OR_HTTP11 = 0x10, OR_POST_MULTIPART = 0x20, OR_POST_URLENCODED = 0x40, OR_NO_KEEP_ALIVE = 0x0100, OR_HEADER_SENT_ = 0x0200, OR_INTERNAL_ERROR = 0x01000, OR_NOT_IMPLEMENTED = 0x02000, OR_NOT_FOUND = 0x03000, OR_FORBIDDEN = 0x04000 } |
| Flags about the petition, including method, error status, http version. More... | |
Functions | |
| onion_request * | onion_request_new (onion_listen_point *con) |
| Creates a request from a listen point. Socket info and so on must be filled by user. | |
| onion_request * | onion_request_new_from_socket (onion_listen_point *con, int fd, struct sockaddr_storage *cli_addr, socklen_t cli_len) |
| Creates a request, with socket info. | |
| void | onion_request_free (onion_request *req) |
| Deletes a request and all its data. | |
| onion_connection_status | onion_request_write (onion_request *req, const char *data, size_t length) |
| Reads some data from the input (net, file...) and performs the onion_request_fill. | |
| const char * | onion_request_get_path (onion_request *req) |
| Gets the current path. | |
| const char * | onion_request_get_fullpath (onion_request *req) |
| Gets the full path of the request. | |
| 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 path pointer to later in the fullpath. | |
| void | onion_request_session_free (onion_request *req) |
| Frees the session dictionary. | |
| void | onion_request_clean (onion_request *req) |
| Cleans the request object, to reuse it. | |
| void | onion_request_set_no_keep_alive (onion_request *req) |
| Reqeust to close connection after one request is done, forces no keep alive. | |
| int | onion_request_keep_alive (onion_request *req) |
| Returns if current request wants to keep alive. | |
| const char * | onion_request_get_language_code (onion_request *req) |
| Gets the language code for the current language. C is returned if none recognized. | |
| const onion_block * | onion_request_get_data (onion_request *req) |
| Returns extra request data, such as POST with non-form data, or PROPFIND. Needs the Content-Length request header. | |
| void | onion_request_polish (onion_request *req) |
| Performs final touches to the request to its ready to be processed. | |
| onion_connection_status | onion_request_process (onion_request *req) |
| Executes the handler required for this request. | |
| const char * | onion_request_get_client_description (onion_request *req) |
| Get a string with a client description. | |
| struct sockaddr_storage * | onion_request_get_sockadd_storage (onion_request *req, socklen_t *client_len) |
| Get the sockaddr_storage from the client, if any. | |
| bool | onion_request_is_secure (onion_request *req) |
| Determine if the request was sent over a secure listen point. | |
Get header, query, post, file data and session | |
| 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 query data. | |
| const char * | onion_request_get_queryd (onion_request *req, const char *key, const char *def) |
| Gets query data, but returns a default value if key not found. | |
| const char * | onion_request_get_post (onion_request *req, const char *query) |
| Gets 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 *query) |
| 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 post data dict. | |
| onion_dict * | onion_request_get_session_dict (onion_request *req) |
| Gets session data dict. | |
| onion_dict * | onion_request_get_cookies_dict (onion_request *req) |
| Gets the cookies dict. | |
| const char * | onion_request_get_cookie (onion_request *req, const char *cookiename) |
| Gets a cookie value. | |
Variables | |
| const char * | onion_request_methods [16] |
| List of known methods. NULL empty space, position is the method as listed at the flags. | |
| typedef enum onion_request_flags_e onion_request_flags |
| void onion_request_advance_path | ( | onion_request * | req, |
| off_t | addtopos | ||
| ) |
Moves the path pointer to later in the fullpath.
| void onion_request_clean | ( | onion_request * | req | ) |
Cleans the request object, to reuse it.
| void onion_request_free | ( | onion_request * | req | ) |
Deletes a request and all its data.
| const char* onion_request_get_client_description | ( | onion_request * | req | ) |
Get a string with a client description.
| const char* onion_request_get_cookie | ( | onion_request * | req, |
| const char * | cookiename | ||
| ) |
Gets a cookie value.
| onion_dict* onion_request_get_cookies_dict | ( | onion_request * | req | ) |
Gets the cookies dict.
| const onion_block* onion_request_get_data | ( | onion_request * | req | ) |
Returns extra request data, such as POST with non-form data, or PROPFIND. Needs the Content-Length request header.
| const char* onion_request_get_file | ( | onion_request * | req, |
| const char * | query | ||
| ) |
Gets file data.
| const onion_dict* onion_request_get_file_dict | ( | onion_request * | req | ) |
Gets post data dict.
| onion_request_flags onion_request_get_flags | ( | onion_request * | req | ) |
Gets the current flags, as in onion_request_flags_e.
| const char* onion_request_get_fullpath | ( | onion_request * | req | ) |
Gets the full path of the request.
| const char* onion_request_get_header | ( | onion_request * | req, |
| const char * | header | ||
| ) |
Gets a header data.
| const onion_dict* onion_request_get_header_dict | ( | onion_request * | req | ) |
Gets the header header data dict.
| const char* onion_request_get_language_code | ( | onion_request * | req | ) |
Gets the language code for the current language. C is returned if none recognized.
| const char* onion_request_get_path | ( | onion_request * | req | ) |
Gets the current path.
| const char* onion_request_get_post | ( | onion_request * | req, |
| const char * | query | ||
| ) |
Gets post data.
| const onion_dict* onion_request_get_post_dict | ( | onion_request * | req | ) |
Gets post data dict.
| const char* onion_request_get_query | ( | onion_request * | req, |
| const char * | query | ||
| ) |
Gets query data.
| const onion_dict* onion_request_get_query_dict | ( | onion_request * | req | ) |
Gets request query dict.
| const char* onion_request_get_queryd | ( | onion_request * | req, |
| const char * | key, | ||
| const char * | def | ||
| ) |
Gets query data, but returns a default value if key not found.
| const char* onion_request_get_session | ( | onion_request * | req, |
| const char * | query | ||
| ) |
Gets session data.
| onion_dict* onion_request_get_session_dict | ( | onion_request * | req | ) |
Gets session data dict.
|
read |
Get the sockaddr_storage from the client, if any.
| int onion_request_keep_alive | ( | onion_request * | req | ) |
Returns if current request wants to keep alive.
| onion_request* onion_request_new | ( | onion_listen_point * | con | ) |
Creates a request from a listen point. Socket info and so on must be filled by user.
| void onion_request_polish | ( | onion_request * | req | ) |
Performs final touches to the request to its ready to be processed.
| void onion_request_session_free | ( | onion_request * | req | ) |
Frees the session dictionary.
| void onion_request_set_no_keep_alive | ( | onion_request * | req | ) |
Reqeust to close connection after one request is done, forces no keep alive.
| onion_connection_status onion_request_write | ( | onion_request * | req, |
| const char * | data, | ||
| size_t | size | ||
| ) |
Reads some data from the input (net, file...) and performs the onion_request_fill.
Reads some data from the input (net, file...) and performs the onion_request_fill.
It features a state machine, from req->parse_state.
Depending on the state input is redirected to a diferent parser, one for headers, POST url encoded data...
References OCS_INTERNAL_ERROR, OCS_NEED_MORE_DATA, onion_low_calloc(), onion_request_t::parser, and onion_request_t::parser_data.
Referenced by onion_http_t::onion_http_read_ready().
| const char* onion_request_methods[16] |
List of known methods. NULL empty space, position is the method as listed at the flags.
1.8.1.2