mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'contrib/github_pr_13746' into 'master'
feat(http_server): add 413 Payload Too Large response (GitHub PR) Closes IDFGH-12767 See merge request espressif/esp-idf!31058
This commit is contained in:
commit
245ec91456
@ -468,7 +468,7 @@ static const esp_err_msg_t esp_err_msg_table[] = {
|
||||
ERR_TBL_IT(ESP_ERR_DPP_INVALID_ATTR), /* 12441 0x3099 Encountered invalid DPP Attribute */
|
||||
# endif
|
||||
# ifdef ESP_ERR_DPP_AUTH_TIMEOUT
|
||||
ERR_TBL_IT(ESP_ERR_DPP_AUTH_TIMEOUT), /* 12442 0x309a DPP Auth response was not recieved in time */
|
||||
ERR_TBL_IT(ESP_ERR_DPP_AUTH_TIMEOUT), /* 12442 0x309a DPP Auth response was not received in time */
|
||||
# endif
|
||||
// components/esp_common/include/esp_err.h
|
||||
# ifdef ESP_ERR_MESH_BASE
|
||||
@ -781,7 +781,7 @@ static const esp_err_msg_t esp_err_msg_table[] = {
|
||||
ERR_TBL_IT(ESP_ERR_HTTPD_RESP_HDR), /* 45061 0xb005 Response header field larger than supported */
|
||||
# endif
|
||||
# ifdef ESP_ERR_HTTPD_RESP_SEND
|
||||
ERR_TBL_IT(ESP_ERR_HTTPD_RESP_SEND), /* 45062 0xb006 Error occured while sending response packet */
|
||||
ERR_TBL_IT(ESP_ERR_HTTPD_RESP_SEND), /* 45062 0xb006 Error occurred while sending response packet */
|
||||
# endif
|
||||
# ifdef ESP_ERR_HTTPD_ALLOC_MEM
|
||||
ERR_TBL_IT(ESP_ERR_HTTPD_ALLOC_MEM), /* 45063 0xb007 Failed to dynamically allocate memory
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -85,7 +85,7 @@ initializer that should be kept in sync
|
||||
#define ESP_ERR_HTTPD_INVALID_REQ (ESP_ERR_HTTPD_BASE + 3) /*!< Invalid request pointer */
|
||||
#define ESP_ERR_HTTPD_RESULT_TRUNC (ESP_ERR_HTTPD_BASE + 4) /*!< Result string truncated */
|
||||
#define ESP_ERR_HTTPD_RESP_HDR (ESP_ERR_HTTPD_BASE + 5) /*!< Response header field larger than supported */
|
||||
#define ESP_ERR_HTTPD_RESP_SEND (ESP_ERR_HTTPD_BASE + 6) /*!< Error occured while sending response packet */
|
||||
#define ESP_ERR_HTTPD_RESP_SEND (ESP_ERR_HTTPD_BASE + 6) /*!< Error occurred while sending response packet */
|
||||
#define ESP_ERR_HTTPD_ALLOC_MEM (ESP_ERR_HTTPD_BASE + 7) /*!< Failed to dynamically allocate memory for resource */
|
||||
#define ESP_ERR_HTTPD_TASK (ESP_ERR_HTTPD_BASE + 8) /*!< Failed to launch server task/thread */
|
||||
|
||||
@ -608,6 +608,9 @@ typedef enum {
|
||||
*/
|
||||
HTTPD_411_LENGTH_REQUIRED,
|
||||
|
||||
/* Incoming payload is too large */
|
||||
HTTPD_413_CONTENT_TOO_LARGE,
|
||||
|
||||
/* URI length greater than CONFIG_HTTPD_MAX_URI_LEN */
|
||||
HTTPD_414_URI_TOO_LONG,
|
||||
|
||||
@ -1048,9 +1051,9 @@ esp_err_t httpd_req_get_cookie_val(httpd_req_t *req, const char *cookie_name, ch
|
||||
*
|
||||
* 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
|
||||
* - /api/? matches /api and /api/
|
||||
* - /api/\* (sans the backslash) matches /api/ and /api/status, but not /api or /ap
|
||||
* - /api/?* or /api/\*? (sans the backslash) matches /api/, /api/status, and also /api, but not /apix or /ap
|
||||
*
|
||||
* The special characters "?" and "*" anywhere else in the template will be taken literally.
|
||||
*
|
||||
@ -1400,7 +1403,7 @@ static inline esp_err_t httpd_resp_send_500(httpd_req_t *r) {
|
||||
* 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
|
||||
* manually, and HTTP delimiters (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
|
||||
|
@ -432,6 +432,10 @@ esp_err_t httpd_resp_send_err(httpd_req_t *req, httpd_err_code_t error, const ch
|
||||
status = "411 Length Required";
|
||||
msg = "Client must specify Content-Length";
|
||||
break;
|
||||
case HTTPD_413_CONTENT_TOO_LARGE:
|
||||
status = "413 Content Too Large";
|
||||
msg = "Content is too large";
|
||||
break;
|
||||
case HTTPD_431_REQ_HDR_FIELDS_TOO_LARGE:
|
||||
status = "431 Request Header Fields Too Large";
|
||||
msg = "Header fields are too long";
|
||||
|
@ -21,7 +21,7 @@ extern "C" {
|
||||
#define ESP_ERR_DPP_FAILURE (ESP_ERR_WIFI_BASE + 151) /*!< Generic failure during DPP Operation */
|
||||
#define ESP_ERR_DPP_TX_FAILURE (ESP_ERR_WIFI_BASE + 152) /*!< DPP Frame Tx failed OR not Acked */
|
||||
#define ESP_ERR_DPP_INVALID_ATTR (ESP_ERR_WIFI_BASE + 153) /*!< Encountered invalid DPP Attribute */
|
||||
#define ESP_ERR_DPP_AUTH_TIMEOUT (ESP_ERR_WIFI_BASE + 154) /*!< DPP Auth response was not recieved in time */
|
||||
#define ESP_ERR_DPP_AUTH_TIMEOUT (ESP_ERR_WIFI_BASE + 154) /*!< DPP Auth response was not received in time */
|
||||
/** @brief Types of Bootstrap Methods for DPP. */
|
||||
typedef enum dpp_bootstrap_type {
|
||||
DPP_BOOTSTRAP_QR_CODE, /**< QR Code Method */
|
||||
|
Loading…
Reference in New Issue
Block a user