HomePort
Functions
httpd_request.h File Reference
Include dependency graph for httpd_request.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

hpd_error_t http_request_create (hpd_httpd_request_t **req, hpd_httpd_t *httpd, hpd_httpd_settings_t *settings, hpd_tcpd_conn_t *conn, const hpd_module_t *context)
 Create a new ws_request. More...
 
hpd_error_t http_request_destroy (hpd_httpd_request_t *req)
 Destroy a ws_request. More...
 
hpd_error_t http_request_get_connection (hpd_httpd_request_t *req, hpd_tcpd_conn_t **conn)
 Get the connection of a request. More...
 
hpd_error_t http_request_get_context (hpd_httpd_request_t *req, const hpd_module_t **context)
 
hpd_error_t http_request_parse (hpd_httpd_request_t *req, const char *buf, size_t len)
 Parse a new chunk of the message. More...
 

Function Documentation

hpd_error_t http_request_create ( hpd_httpd_request_t **  req,
hpd_httpd_t httpd,
hpd_httpd_settings_t settings,
hpd_tcpd_conn_t conn,
const hpd_module_t context 
)

Create a new ws_request.

The created ws_request is ready to receive data through ws_reqeust_parse(), and it should be freed using ws_request_destroy() to avoid memory leaks.

Parameters
webserverThe httpd creating the request
settingsThe settings for the webserver receiving the request. This will determine which callbacks to call on events.
connThe connection on which the request is being received
Returns
The newly create ws_request.

Definition at line 601 of file httpd_request.c.

Here is the call graph for this function:

Here is the caller graph for this function:

hpd_error_t http_request_destroy ( hpd_httpd_request_t req)

Destroy a ws_request.

All ws_requests should be freed by a call to this function to avoid memory leaks.

Parameters
reqThe request to be destroyed.

Definition at line 660 of file httpd_request.c.

Here is the call graph for this function:

Here is the caller graph for this function:

hpd_error_t http_request_get_connection ( hpd_httpd_request_t req,
hpd_tcpd_conn_t **  conn 
)

Get the connection of a request.

Parameters
reqhttp request
Returns
The connection

Definition at line 889 of file httpd_request.c.

Here is the caller graph for this function:

hpd_error_t http_request_get_context ( hpd_httpd_request_t req,
const hpd_module_t **  context 
)

Definition at line 931 of file httpd_request.c.

Here is the caller graph for this function:

hpd_error_t http_request_parse ( hpd_httpd_request_t req,
const char *  buf,
size_t  len 
)

Parse a new chunk of the message.

This will sent the chunk to the http_parser, which will parse the new chunk and call the callbacks defined in parser_settings on events. The callbacks will change state of the ws_request and make calls on the functions defined in hpd_tcpd_settings.

Parameters
reqThe request, to which the chunk should be added.
bufThe chunk, which is not assumed to be \0 terminated.
lenLength of the chuck.
Returns
What http_parser_execute() returns.

Definition at line 697 of file httpd_request.c.

Here is the caller graph for this function: