Chapter 2. API Reference
If a context needs to be maintained between these functions, store it in the session using
httpd_sess_set_transport_ctx() and retrieve it later with httpd_sess_get_transport_ctx()
Returning a value other than ESP_OK will immediately close the new socket.
httpd_close_func_t
close_fn
Custom session closing callback.
Called when a session is deleted, before freeing user and transport contexts and before closing the socket.
This is a place for custom de-init code common to all sockets.
Set the user or transport context to NULL if it was freed here, so the server does not try to free it again.
This function is run for all terminated sessions, including sessions where the socket was closed by the
network stack - that is, the file descriptor may not be valid anymore.
httpd_uri_match_func_t
URI matcher function.
Called when searching for a matching URI: 1) whose request handler is to be executed right after an HTTP
request is successfully parsed 2) in order to prevent duplication while registering a new URI handler using
httpd_register_uri_handler()
Available options are:
httpd_uri_match_wildcard() : URI wildcard matcher
Users
can
httpd_uri_match_func_t function prototype)
struct httpd_req
HTTP Request Data Structure.
Public Members
httpd_handle_t
handle
Handle to server instance
int method
The type of HTTP request, -1 if unsupported method
const char uri[HTTPD_MAX_URI_LEN + 1]
The URI of this request (1 byte extra for null termination)
size_t content_len
Length of the request body
void *aux
Internally used members
void *user_ctx
User context pointer passed during URI registration.
void *sess_ctx
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.
httpd_free_ctx_fn_t
Pointer to free context hook
Function to free session context
Espressif Systems
uri_match_fn
1) NULL : Internally do basic matching using strncmp() 2)
implement
their
own
free_ctx
Submit Document Feedback
matching
functions
588
(See
description
of
Release v4.4
the
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?