Function esp_idf_sys::httpd_resp_send_chunk
source ยท pub unsafe extern "C" fn httpd_resp_send_chunk(
r: *mut httpd_req_t,
buf: *const c_char,
buf_len: isize,
) -> esp_err_t
Expand description
@brief API to send one HTTP chunk
This API will send the data as an HTTP response to the request. This API will use chunked-encoding and send the response in the form of chunks. If you have the entire response contained in a single buffer, please use httpd_resp_send() instead.
If no status code and content-type were set, by default this will send 200 OK status code and content type as text/html. You may call the following functions before this API to configure the response headers httpd_resp_set_status() - for setting the HTTP status string, httpd_resp_set_type() - for setting the Content Type, httpd_resp_set_hdr() - for appending any additional field value entries in the response header
@note
- This API is supposed to be called only from the context of a URI handler where httpd_req_t* request pointer is valid.
- When you are finished sending all your chunks, you must call this function with buf_len as 0.
- Once this API is called, all request headers are purged, so request headers need be copied into separate buffers if they are required later.
@param[in] r The request being responded to @param[in] buf Pointer to a buffer that stores the data @param[in] buf_len Length of the buffer, HTTPD_RESP_USE_STRLEN to use strlen()
@return
- ESP_OK : On successfully sending the response packet chunk
- ESP_ERR_INVALID_ARG : Null request pointer
- ESP_ERR_HTTPD_RESP_HDR : Essential headers are too large for internal buffer
- ESP_ERR_HTTPD_RESP_SEND : Error in raw send
- ESP_ERR_HTTPD_INVALID_REQ : Invalid request pointer