EasyManua.ls Logo

Espressif ESP32-S2 - Page 593

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
Helper function for HTTP 408.
Send HTTP 408 message. If you wish to send additional data in the body of the response, please use the
lower-level functions directly.
Note
This API is supposed to be called only from the context of a URI handler where httpd_req_t* request
pointer is valid.
Once this API is called, all request headers are purged, so request headers need be copied into
separate buffers if they are required later.
Return
ESP_OK : On successfully sending the response packet
ESP_ERR_INVALID_ARG : Null arguments
ESP_ERR_HTTPD_RESP_SEND : Error in raw send
ESP_ERR_HTTPD_INVALID_REQ : Invalid request pointer
Parameters
[in] r: The request being responded to
static esp_err_t httpd_resp_send_500(httpd_req_t *r)
Helper function for HTTP 500.
Send HTTP 500 message. If you wish to send additional data in the body of the response, please use the
lower-level functions directly.
Note
This API is supposed to be called only from the context of a URI handler where httpd_req_t* request
pointer is valid.
Once this API is called, all request headers are purged, so request headers need be copied into
separate buffers if they are required later.
Return
ESP_OK : On successfully sending the response packet
ESP_ERR_INVALID_ARG : Null arguments
ESP_ERR_HTTPD_RESP_SEND : Error in raw send
ESP_ERR_HTTPD_INVALID_REQ : Invalid request pointer
Parameters
[in] r: The request being responded to
int httpd_send(httpd_req_t *r, const char *buf, size_t buf_len)
Raw HTTP send.
Call this API if you wish to construct your custom response packet. When using this, all essential header, eg.
HTTP version, Status Code, Content Type and Length, Encoding, etc. will have to be constructed manually,
and HTTP delimeters (CRLF) will need to be placed correctly for separating sub-sections of the HTTP response
packet.
If the send override function is set, this API will end up calling that function eventually to send data out.
Note
This API is supposed to be called only from the context of a URI handler where httpd_req_t* request
pointer is valid.
Unless the response has the correct HTTP structure (which the user must now ensure) it is not
guaranteed that it will be recognized by the client. For most cases, you wouldnt have to call this
API, but you would rather use either of : httpd_resp_send(), httpd_resp_send_chunk()
Return
Bytes : Number of bytes that were sent successfully
HTTPD_SOCK_ERR_INVALID : Invalid arguments
HTTPD_SOCK_ERR_TIMEOUT : Timeout/interrupted while calling socket send()
HTTPD_SOCK_ERR_FAIL : Unrecoverable error while calling socket send()
Parameters
[in] r: The request being responded to
[in] buf: Buffer from where the fully constructed packet is to be read
[in] buf_len: Length of the buffer
Espressif Systems 582
Submit Document Feedback
Release v4.4

Table of Contents