Merge branch 'bugfix/check_for_eof' into 'master'

esp_http_server, protocomm: Close the connection when recv() returns 0

Closes IDFGH-4735

See merge request espressif/esp-idf!12747
This commit is contained in:
Mahavir Jain 2021-06-08 14:41:33 +00:00
commit 3a65e38bfa
2 changed files with 2 additions and 2 deletions

View File

@ -802,7 +802,7 @@ esp_err_t httpd_req_delete(struct httpd_data *hd)
char dummy[CONFIG_HTTPD_PURGE_BUF_LEN];
int recv_len = MIN(sizeof(dummy), ra->remaining_len);
recv_len = httpd_req_recv(r, dummy, recv_len);
if (recv_len < 0) {
if (recv_len <= 0) {
httpd_req_cleanup(r);
return ESP_FAIL;
}

View File

@ -136,7 +136,7 @@ static esp_err_t common_post_handler(httpd_req_t *req)
size_t recv_size = 0;
while (recv_size < req->content_len) {
ret = httpd_req_recv(req, req_body + recv_size, req->content_len - recv_size);
if (ret < 0) {
if (ret <= 0) {
ret = ESP_FAIL;
goto out;
}