mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'bugfix/fix_http_head_request_v4.2' into 'release/v4.2'
esp_http_client: Fix HEAD request will affect the all next HTTP requests unless we close the HTTP request(backport v4.2) See merge request espressif/esp-idf!15713
This commit is contained in:
@ -248,6 +248,13 @@ static int http_on_headers_complete(http_parser *parser)
|
|||||||
client->response->data_process = 0;
|
client->response->data_process = 0;
|
||||||
ESP_LOGD(TAG, "http_on_headers_complete, status=%d, offset=%d, nread=%d", parser->status_code, client->response->data_offset, parser->nread);
|
ESP_LOGD(TAG, "http_on_headers_complete, status=%d, offset=%d, nread=%d", parser->status_code, client->response->data_offset, parser->nread);
|
||||||
client->state = HTTP_STATE_RES_COMPLETE_HEADER;
|
client->state = HTTP_STATE_RES_COMPLETE_HEADER;
|
||||||
|
if (client->connection_info.method == HTTP_METHOD_HEAD) {
|
||||||
|
/* In a HTTP_RESPONSE parser returning '1' from on_headers_complete will tell the
|
||||||
|
parser that it should not expect a body. This is used when receiving a response
|
||||||
|
to a HEAD request which may contain 'Content-Length' or 'Transfer-Encoding: chunked'
|
||||||
|
headers that indicate the presence of a body.*/
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user