Chapter 2. API Reference
Note
• The components of URL query string (keys and values) are not URLdecoded. The user must check
for 'Content-Type'field in the request headers and then depending upon the specified encoding
(URLencoded or otherwise) apply the appropriate decoding algorithm.
• If actual value size is greater than val_size, then the value is truncated, accompanied by truncation
error as return value.
Return
• ESP_OK : Key is found in the URL query string and copied to buffer
• ESP_ERR_NOT_FOUND : Key not found
• ESP_ERR_INVALID_ARG : Null arguments
• ESP_ERR_HTTPD_RESULT_TRUNC : Value string truncated
Parameters
• [in] qry: Pointer to query string
• [in] key: The key to be searched in the query string
• [out] val: Pointer to the buffer into which the value will be copied if the key is found
• [in] val_size: Size of the user buffer "val"
esp_err_t httpd_req_get_cookie_val(httpd_req_t
Get the value string of a cookie value from the "Cookie"request headers by cookie name.
Return
• ESP_OK : Key is found in the cookie string and copied to buffer
• ESP_ERR_NOT_FOUND : Key not found
• ESP_ERR_INVALID_ARG : Null arguments
• ESP_ERR_HTTPD_RESULT_TRUNC : Value string truncated
• ESP_ERR_NO_MEM : Memory allocation failure
Parameters
• [in] req: Pointer to the HTTP request
• [in] cookie_name: The cookie name to be searched in the request
• [out] val: Pointer to the buffer into which the value of cookie will be copied if the cookie is
found
• [inout]
able will contain cookie length if ESP_OK is returned and required buffer length incase
ESP_ERR_HTTPD_RESULT_TRUNC is returned.
bool httpd_uri_match_wildcard(const char *uri_template, const char *uri_to_match, size_t
Test if a URI matches the given wildcard template.
Template may end with "?"to make the previous character optional (typically a slash), "*"for a wildcard
match, and "?*"to make the previous character optional, and if present, allow anything to follow.
Example:
• * matches everything
• /foo/? matches /foo and /foo/
• /foo/* (sans the backslash) matches /foo/ and /foo/bar, but not /foo or /fo
• /foo/?* or /foo/*? (sans the backslash) matches /foo/, /foo/bar, and also /foo, but not /foox or /fo
The special characters "?"and "*"anywhere else in the template will be taken literally.
Return true if a match was found
Parameters
• [in] uri_template: URI template (pattern)
• [in] uri_to_match: URI to be matched
• [in] match_upto: how many characters of the URI buffer to test (there may be trailing query
string etc.)
esp_err_t httpd_resp_send(httpd_req_t
API to send a complete HTTP response.
This API will send the data as an HTTP response to the request. This assumes that you have the entire response
Espressif Systems
size_t *val_size)
val_size:
Pointer to size of the user buffer "val".
match_upto)
*r, const char *buf, ssize_t buf_len)
578
Submit Document Feedback
*req, const char *cookie_name, char *val,
This vari-
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?