DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
Loading...
Searching...
No Matches
HttpReq Struct Reference

Fully-parsed HTTP/1.1 request. More...

#include <http_parser.h>

Public Attributes

uint8_t slot_id
 Transport slot index (set by presentation layer).
 
ParseState parse_state
 Current parser state.
 
HttpVersion version
 Protocol version parsed from the request line.
 
uint32_t _version_hash
 FNV-1a accumulator for version validation (internal).
 
char method [DETWS_METHOD_BUF_SIZE]
 HTTP method, null-terminated (OPTIONS, or WebDAV methods when enabled).
 
char path [MAX_PATH_LEN]
 URL path, null-terminated; no query string.
 
size_t path_idx
 Write cursor into path[].
 
char query [MAX_QUERY_LEN]
 Raw query string (after ?).
 
size_t query_idx
 Write cursor into query[].
 
QueryParam query_params [MAX_QUERY_PARAMS]
 Parsed key=value pairs.
 
uint8_t query_count
 Valid entries in query_params[].
 
QueryParam path_params [MAX_PATH_PARAMS]
 :name captures from the matched route.
 
uint8_t path_param_count
 Valid entries in path_params[].
 
Header headers [MAX_HEADERS]
 Captured header fields.
 
uint8_t header_count
 Valid entries in headers[].
 
size_t current_token_idx
 Write cursor shared by key/value sub-states.
 
char cur_key [MAX_KEY_LEN]
 Field-name of the in-progress header.
 
char cur_val [MAX_VAL_LEN]
 Field-value of the in-progress header.
 
size_t content_length
 Value of Content-Length header (0 if absent).
 
uint8_t content_length_count
 Number of Content-Length fields seen (RFC 7230 §3.3.2).
 
uint8_t host_count
 Number of Host fields seen (RFC 7230 §5.4).
 
size_t body_bytes_read
 Body bytes received (may exceed BODY_BUF_SIZE).
 
uint8_t body [BODY_BUF_SIZE+1]
 Stored body bytes, always null-terminated.
 
size_t body_len
 Bytes stored in body[] (≤ BODY_BUF_SIZE).
 

Detailed Description

Fully-parsed HTTP/1.1 request.

Populated incrementally by http_parser_feed(). Valid for dispatch only when parse_state == ParseState::PARSE_COMPLETE.

Call http_parser_reset() to recycle this struct for the next request.

Definition at line 110 of file http_parser.h.

Member Data Documentation

◆ slot_id

uint8_t HttpReq::slot_id

Transport slot index (set by presentation layer).

Definition at line 112 of file http_parser.h.

Referenced by http_parser_reset(), and http_reset().

◆ parse_state

ParseState HttpReq::parse_state

Current parser state.

Definition at line 113 of file http_parser.h.

Referenced by http_parse(), http_parser_feed(), and http_parser_reset().

◆ version

HttpVersion HttpReq::version

Protocol version parsed from the request line.

Definition at line 114 of file http_parser.h.

Referenced by http_parser_feed(), and DetWebServer::send_chunked().

◆ _version_hash

uint32_t HttpReq::_version_hash

FNV-1a accumulator for version validation (internal).

Definition at line 115 of file http_parser.h.

Referenced by http_parser_feed(), and http_parser_reset().

◆ method

char HttpReq::method[DETWS_METHOD_BUF_SIZE]

HTTP method, null-terminated (OPTIONS, or WebDAV methods when enabled).

Definition at line 117 of file http_parser.h.

Referenced by http_parser_feed().

◆ path

char HttpReq::path[MAX_PATH_LEN]

URL path, null-terminated; no query string.

Definition at line 118 of file http_parser.h.

Referenced by http_parser_feed().

◆ path_idx

size_t HttpReq::path_idx

Write cursor into path[].

Definition at line 119 of file http_parser.h.

Referenced by http_parser_feed().

◆ query

char HttpReq::query[MAX_QUERY_LEN]

Raw query string (after ?).

Definition at line 121 of file http_parser.h.

Referenced by http_parser_feed().

◆ query_idx

size_t HttpReq::query_idx

Write cursor into query[].

Definition at line 122 of file http_parser.h.

Referenced by http_parser_feed().

◆ query_params

QueryParam HttpReq::query_params[MAX_QUERY_PARAMS]

Parsed key=value pairs.

Definition at line 123 of file http_parser.h.

Referenced by http_get_query().

◆ query_count

uint8_t HttpReq::query_count

Valid entries in query_params[].

Definition at line 124 of file http_parser.h.

Referenced by http_get_query().

◆ path_params

QueryParam HttpReq::path_params[MAX_PATH_PARAMS]

:name captures from the matched route.

Definition at line 126 of file http_parser.h.

Referenced by http_get_param().

◆ path_param_count

uint8_t HttpReq::path_param_count

Valid entries in path_params[].

Definition at line 127 of file http_parser.h.

Referenced by http_get_param().

◆ headers

Header HttpReq::headers[MAX_HEADERS]

Captured header fields.

Definition at line 135 of file http_parser.h.

Referenced by http_get_header(), and http_parser_feed().

◆ header_count

uint8_t HttpReq::header_count

Valid entries in headers[].

Definition at line 136 of file http_parser.h.

Referenced by http_get_header(), and http_parser_feed().

◆ current_token_idx

size_t HttpReq::current_token_idx

Write cursor shared by key/value sub-states.

Definition at line 137 of file http_parser.h.

Referenced by http_parser_feed().

◆ cur_key

char HttpReq::cur_key[MAX_KEY_LEN]

Field-name of the in-progress header.

Definition at line 142 of file http_parser.h.

Referenced by http_parser_feed().

◆ cur_val

char HttpReq::cur_val[MAX_VAL_LEN]

Field-value of the in-progress header.

Definition at line 143 of file http_parser.h.

Referenced by http_parser_feed().

◆ content_length

size_t HttpReq::content_length

Value of Content-Length header (0 if absent).

Definition at line 145 of file http_parser.h.

Referenced by http_parser_feed().

◆ content_length_count

uint8_t HttpReq::content_length_count

Number of Content-Length fields seen (RFC 7230 §3.3.2).

Definition at line 146 of file http_parser.h.

Referenced by http_parser_feed().

◆ host_count

uint8_t HttpReq::host_count

Number of Host fields seen (RFC 7230 §5.4).

Definition at line 147 of file http_parser.h.

Referenced by http_parser_feed().

◆ body_bytes_read

size_t HttpReq::body_bytes_read

Body bytes received (may exceed BODY_BUF_SIZE).

Definition at line 148 of file http_parser.h.

Referenced by http_parser_feed().

◆ body

uint8_t HttpReq::body[BODY_BUF_SIZE+1]

Stored body bytes, always null-terminated.

Definition at line 150 of file http_parser.h.

Referenced by http_get_form(), http_parser_feed(), and multipart_parse().

◆ body_len

size_t HttpReq::body_len

Bytes stored in body[] (≤ BODY_BUF_SIZE).

Definition at line 151 of file http_parser.h.

Referenced by http_get_form(), http_parser_feed(), and multipart_parse().


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