mirror of
https://github.com/curl/curl.git
synced 2026-06-03 13:04:16 +03:00
http: prefer chunked encoding over Content-Length: 0
Call http_size() before checking the request for empty body to prefer Transfer-Encoding: chunked even if Content-Length is 0. Closes #21706
This commit is contained in:
parent
28341c303d
commit
ba600296d2
3 changed files with 89 additions and 9 deletions
19
lib/http.c
19
lib/http.c
|
|
@ -4172,6 +4172,17 @@ static CURLcode http_on_response(struct Curl_easy *data,
|
|||
goto out;
|
||||
}
|
||||
|
||||
/* final response without error, prepare to receive the body */
|
||||
result = http_firstwrite(data);
|
||||
if(result)
|
||||
goto out;
|
||||
|
||||
/* This is the last response that we get for the current request. Check on
|
||||
* the body size and determine if the response is complete. */
|
||||
result = http_size(data);
|
||||
if(result)
|
||||
goto out;
|
||||
|
||||
/* If we requested a "no body", this is a good time to get
|
||||
* out and return home.
|
||||
*/
|
||||
|
|
@ -4185,14 +4196,6 @@ static CURLcode http_on_response(struct Curl_easy *data,
|
|||
if((k->maxdownload == 0) && (k->httpversion_sent < 20))
|
||||
k->download_done = TRUE;
|
||||
|
||||
/* final response without error, prepare to receive the body */
|
||||
result = http_firstwrite(data);
|
||||
|
||||
if(!result)
|
||||
/* This is the last response that we get for the current request. Check on
|
||||
* the body size and determine if the response is complete. */
|
||||
result = http_size(data);
|
||||
|
||||
out:
|
||||
if(last_hd)
|
||||
/* if not written yet, write it now */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue