DeterministicESPAsyncWebServer 1.2.0
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 [8]
 HTTP method, null-terminated (max 7: OPTIONS).
 
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[].
 
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.
 
size_t content_length
 Value of Content-Length header (0 if absent).
 
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 == 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().

◆ _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[8]

HTTP method, null-terminated (max 7: OPTIONS).

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

◆ headers

Header HttpReq::headers[MAX_HEADERS]

Captured header fields.

Definition at line 126 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 127 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 128 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 130 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 131 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 133 of file http_parser.h.

Referenced by http_parser_feed(), and multipart_parse().

◆ body_len

size_t HttpReq::body_len

Bytes stored in body[] (≤ BODY_BUF_SIZE).

Definition at line 134 of file http_parser.h.

Referenced by http_parser_feed().


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