Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(http_server): add 413 Payload Too Large response (IDFGH-12767) #13746

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions components/esp_http_server/include/esp_http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,9 @@ typedef enum {
*/
HTTPD_411_LENGTH_REQUIRED,

/* Incoming payload is too large */
HTTPD_413_PAYLOAD_TOO_LARGE,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest changing to:

HTTPD_413_CONTENT_TOO_LARGE

same comment at other places too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to change this by all means, but all the other names appear to follow the literal HTTP status code names as defined in spec, so just curious as to the motivation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by other places, he meant at other changes in this PR. Anyways, we have updated the commit to have that change. The MR is in internal review right now. The commit will be reflected on GitHub once the MR gets merged internally. Thanks for your contribution.


/* URI length greater than CONFIG_HTTPD_MAX_URI_LEN */
HTTPD_414_URI_TOO_LONG,

Expand Down
4 changes: 4 additions & 0 deletions components/esp_http_server/src/httpd_txrx.c
Original file line number Diff line number Diff line change
Expand 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_PAYLOAD_TOO_LARGE:
status = "413 Payload Too Large";
msg = "Payload 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";
Expand Down
Loading