Type Alias esp_idf_hal::sys::httpd_req_t

source ·
pub type httpd_req_t = httpd_req;
Expand description

@brief HTTP Request Data Structure

Aliased Type§

struct httpd_req_t {
    pub handle: *mut c_void,
    pub method: i32,
    pub uri: [i8; 513],
    pub content_len: usize,
    pub aux: *mut c_void,
    pub user_ctx: *mut c_void,
    pub sess_ctx: *mut c_void,
    pub free_ctx: Option<unsafe extern "C" fn(_: *mut c_void)>,
    pub ignore_sess_ctx_changes: bool,
}

Fields§

§handle: *mut c_void

< Handle to server instance

§method: i32

< The type of HTTP request, -1 if unsupported method

§uri: [i8; 513]

< The URI of this request (1 byte extra for null termination)

§content_len: usize

< Length of the request body

§aux: *mut c_void

< Internally used members

§user_ctx: *mut c_void

User context pointer passed during URI registration.

§sess_ctx: *mut c_void

Session Context Pointer

A session context. Contexts are maintained across ‘sessions’ for a given open TCP connection. One session could have multiple request responses. The web server will ensure that the context persists across all these request and responses.

By default, this is NULL. URI Handlers can set this to any meaningful value.

If the underlying socket gets closed, and this pointer is non-NULL, the web server will free up the context by calling free(), unless free_ctx function is set.

§free_ctx: Option<unsafe extern "C" fn(_: *mut c_void)>

Pointer to free context hook

Function to free session context

If the web server’s socket closes, it frees up the session context by calling free() on the sess_ctx member. If you wish to use a custom function for freeing the session context, please specify that here.

§ignore_sess_ctx_changes: bool

Flag indicating if Session Context changes should be ignored

By default, if you change the sess_ctx in some URI handler, the http server will internally free the earlier context (if non NULL), after the URI handler returns. If you want to manage the allocation/reallocation/freeing of sess_ctx yourself, set this flag to true, so that the server will not perform any checks on it. The context will be cleared by the server (by calling free_ctx or free()) only if the socket gets closed.