#[repr(C)]
pub struct httpd_req { pub handle: httpd_handle_t, pub method: c_int, pub uri: [c_char; 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: httpd_free_ctx_fn_t, pub ignore_sess_ctx_changes: bool, }
Expand description

@brief HTTP Request Data Structure

Fields

handle: httpd_handle_t

< Handle to server instance

method: c_int

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

uri: [c_char; 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: httpd_free_ctx_fn_t

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.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.