|
NetBurner 3.5.8
PDF Version |
HTTP Request Structure. More...
#include <http.h>
Public Member Functions | |
| void | ProcessLine (PSTR startofline) |
| internal function | |
| int | Respond (int socket) |
| internal function | |
| uint32_t | ReadBudgetTicks () const |
| Ticks a body read may block for without exceeding this request's total read budget. | |
| bool | ExtractAuthentication (char **pPassword, char **pUser) |
| used to extract user name and password in authentication test | |
| const char * | GetBoundaryMarker () |
| Extracts the boundary marker string from multipart Content-Type headers. | |
| int | ReadSimpleBody (int socket, const char *boundary=NULL) |
| Reads the HTTP request body from a socket into the internal buffer and processes termination conditions. | |
Public Attributes | |
| PSTR | pURL |
| Request URL. | |
| PSTR | pAuthorization |
| Authorization header if present, otherwise null. | |
| PSTR | pFirstCookie |
| First cookie if present, otherwise null. More may follow. | |
| PSTR | pData |
| Pointer to entire data set. Note: not null terminated. | |
| PSTR | pSep |
| Separator for multipart forms, null if not present. | |
| PSTR | pHost |
| Pointer to host record null if not present. | |
| PSTR | last_datarx |
| Pointer to last data read, internal use only. | |
| PSTR | wsKey |
| Web socket ket, internal use only. | |
| PSTR | wsProtocol |
| Web socket prototocl, internal use only. | |
| uint16_t | sep_len |
| Length of separator for multipart forms. | |
| uint32_t | content_length |
| Content length field from HTML header. | |
| uint32_t | rx_length |
| Total bytes receive from request, internal use only. | |
| uint32_t | read_start_secs |
| Value of Secs when this request started, internal use only. | |
| IPADDR | client_IPaddr |
| IP address of client. | |
| uint8_t | websocketFlags |
| Web socket flags. | |
| HTTP_RequestTypes | req |
| Type of request HTTP_RequestTypes. | |
HTTP Request Structure.
This structure is populated before a HTTP request is sent out.
| const char * HTTP_Request::GetBoundaryMarker | ( | ) |
Extracts the boundary marker string from multipart Content-Type headers.
This function searches through the previously parsed HTTP headers to locate and extract the boundary parameter from the Content-Type header when multipart content is present. The boundary marker is used to delimit individual parts within multipart HTTP content such as multipart/form-data or multipart/mixed. The function parses the Content-Type header according to RFC specifications to isolate the boundary value from other Content-Type parameters.
| uint32_t HTTP_Request::ReadBudgetTicks | ( | ) | const |
Ticks a body read may block for without exceeding this request's total read budget.
Every read of inbound request data shares one budget of HTTP_READ_TIME_LIMIT seconds, measured from the moment the request started, so a client that delivers its body slowly cannot hold the web server indefinitely. The value returned is additionally capped at HTTP_BODY_IDLE_TIMEOUT so a connection that falls silent is abandoned promptly rather than occupying the server for the whole budget.
| int HTTP_Request::ReadSimpleBody | ( | int | socket, |
| const char * | boundary = NULL ) |
Reads the HTTP request body from a socket into the internal buffer and processes termination conditions.
This function reads the remaining HTTP request body data from an established socket connection into the buffer backing the request object, preparing the pData member for access. The function handles different HTTP body termination scenarios including content-length bounded bodies, chunked transfer encoding, and boundary-delimited content such as multipart data. Reading continues until one of several termination conditions is met, allowing proper handling of various HTTP body formats.
| socket | File descriptor of the established HTTP connection Must be a valid socket with available data to read |
| boundary | Pointer to null-terminated string containing the boundary sequence that indicates the end of the request body (default: NULL) Used for multipart content or custom termination sequences If NULL, termination is determined by Content-Length or chunked encoding |