libonion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Data Fields

Basic information about a request. More...

#include <types.h>

Public Member Functions

onion_requestonion_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_dictonion_request_get_header_dict (onion_request *req)
 Gets the header header data dict.
const onion_dictonion_request_get_query_dict (onion_request *req)
 Gets request query dict.
const onion_dictonion_request_get_post_dict (onion_request *req)
 Gets post data dict.
const onion_dictonion_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_dictonion_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_blockonion_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_dictonion_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_dictheaders
 Path at this level. Its actually a pointer inside fullpath, removing the leading parts already processed by handlers.
onion_dictGET
 Headers prepared for this response.
onion_dictPOST
 When the query (?q=query) is processed, the dict with the values.
onion_dictFILES
 Dictionary with POST values.
onion_dictsession
 Dictionary with files. They are automatically saved at /tmp/ and removed at request free. mapped string is full path.
onion_blockdata
 Pointer to related session.
onion_dictcookies
 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_websocketwebsocket
 Data necesary while parsing, muy be deleted when state changed. At free is simply freed.
onion_ptr_listfree_list
 Websocket handler.

Detailed Description

Basic information about a request.

Field Documentation

struct sockaddr_storage onion_request_t::cli_addr
char* onion_request_t::cli_info
socklen_t onion_request_t::cli_len
struct { ... } onion_request_t::connection
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
int onion_request_t::fd
onion_dict* onion_request_t::FILES
int onion_request_t::flags
onion_ptr_list* onion_request_t::free_list

Websocket handler.

Referenced by onion_request_clean(), and onion_request_free().

char* onion_request_t::fullpath
onion_dict* onion_request_t::GET
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
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
onion_dict* onion_request_t::POST

When the query (?q=query) is processed, the dict with the values.

See Also
onion_request_parse_query

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
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().


The documentation for this struct was generated from the following files: