pub type httpd_err_handler_func_t = Option<unsafe extern "C" fn(req: *mut httpd_req_t, error: httpd_err_code_t) -> esp_err_t>;
Expand description

@brief Function prototype for HTTP error handling.

This function is executed upon HTTP errors generated during internal processing of an HTTP request. This is used to override the default behavior on error, which is to send HTTP error response and close the underlying socket.

@note

  • If implemented, the server will not automatically send out HTTP error response codes, therefore, httpd_resp_send_err() must be invoked inside this function if user wishes to generate HTTP error responses.
  • When invoked, the validity of uri, method, content_len and user_ctx fields of the httpd_req_t parameter is not guaranteed as the HTTP request may be partially received/parsed.
  • The function must return ESP_OK if underlying socket needs to be kept open. Any other value will ensure that the socket is closed. The return value is ignored when error is of type HTTPD_500_INTERNAL_SERVER_ERROR and the socket closed anyway.

@param[in] req HTTP request for which the error needs to be handled @param[in] error Error type

@return

  • ESP_OK : error handled successful
  • ESP_FAIL : failure indicates that the underlying socket needs to be closed

Aliased Type§

enum httpd_err_handler_func_t {
    None,
    Some(unsafe extern "C" fn(_: *mut httpd_req, _: u32) -> i32),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(_: *mut httpd_req, _: u32) -> i32)

Some value of type T.