Chapter 2. API Reference
Parameters
• [in] ctx: object to free
typedef
esp_err_t (*httpd_open_func_t)(httpd_handle_t
Function prototype for opening a session.
Called immediately after the socket was opened to set up the send/recv functions and other parameters of the
socket.
Return
• ESP_OK : On success
• Any value other than ESP_OK will signal the server to close the socket immediately
Parameters
• [in] hd: server instance
• [in] sockfd: session socket file descriptor
typedef void
(*httpd_close_func_t)(httpd_handle_t
Function prototype for closing a session.
Note It's possible that the socket descriptor is invalid at this point, the function is called for all terminated
sessions. Ensure proper handling of return codes.
Parameters
• [in] hd: server instance
• [in] sockfd: session socket file descriptor
typedef bool (*httpd_uri_match_func_t)(const
Function prototype for URI matching.
Return true on match
Parameters
• [in] reference_uri: URI/template with respect to which the other URI is matched
• [in] uri_to_match: URI/template being matched to the reference URI/template
• [in] match_upto: For specifying the actual length of uri_to_match up to which the match-
ing algorithm is to be applied (The maximum value is strlen(uri_to_match), independent
of the length of reference_uri)
typedef struct
httpd_config
HTTP Server Configuration Structure.
Note Use HTTPD_DEFAULT_CONFIG() to initialize the configuration to a default value and then modify
only those fields that are specifically determined by the use case.
typedef void (*httpd_work_fn_t)(void *arg)
Prototype of the HTTPD work function Please refer to httpd_queue_work() for more details.
Parameters
• [in] arg: The arguments for this work function
Enumerations
enum httpd_err_code_t
Error codes sent as HTTP response in case of errors encountered during processing of an HTTP request.
Values:
HTTPD_500_INTERNAL_SERVER_ERROR = 0
HTTPD_501_METHOD_NOT_IMPLEMENTED
HTTPD_505_VERSION_NOT_SUPPORTED
HTTPD_400_BAD_REQUEST
HTTPD_401_UNAUTHORIZED
HTTPD_403_FORBIDDEN
Espressif Systems
*uri_to_match, size_t match_upto)
httpd_config_t
592
Submit Document Feedback
hd, int sockfd)
hd, int sockfd)
char
*reference_uri,
const
char
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?