mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-01 22:38:30 +00:00
HTTP Server Examples : Updated examples to manually return 408 and 500 errors
This commit is contained in:
@@ -48,7 +48,10 @@ esp_err_t adder_post_handler(httpd_req_t *req)
|
||||
|
||||
/* Read data received in the request */
|
||||
ret = httpd_req_recv(req, buf, sizeof(buf));
|
||||
if (ret < 0) {
|
||||
if (ret <= 0) {
|
||||
if (ret == HTTPD_SOCK_ERR_TIMEOUT) {
|
||||
httpd_resp_send_408(req);
|
||||
}
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
@@ -111,7 +114,10 @@ esp_err_t adder_put_handler(httpd_req_t *req)
|
||||
|
||||
/* Read data received in the request */
|
||||
ret = httpd_req_recv(req, buf, sizeof(buf));
|
||||
if (ret < 0) {
|
||||
if (ret <= 0) {
|
||||
if (ret == HTTPD_SOCK_ERR_TIMEOUT) {
|
||||
httpd_resp_send_408(req);
|
||||
}
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user