Struct esp_idf_svc::sys::httpd_req

source ·
#[repr(C)]
pub struct httpd_req { 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, }
Expand description

@brief HTTP Request Data Structure

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.

Trait Implementations§

source§

impl Clone for httpd_req

source§

fn clone(&self) -> httpd_req

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for httpd_req

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for httpd_req

source§

fn default() -> httpd_req

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

impl Copy for httpd_req

Auto Trait Implementations§

§

impl Freeze for httpd_req

§

impl RefUnwindSafe for httpd_req

§

impl !Send for httpd_req

§

impl !Sync for httpd_req

§

impl Unpin for httpd_req

§

impl UnwindSafe for httpd_req

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> CloneToUninit for T
where T: Copy,

§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.