mirror of
https://github.com/curl/curl.git
synced 2026-06-09 04:14:15 +03:00
tool_cb_hdr: allow etag and content-disposition for 3xx reply
- Parse etag and content-disposition headers for 3xx replies.
For example, a server may send a content-disposition filename header
with a redirect reply (3xx) but not with the final response (2xx).
Without this change curl would ignore the server's specified filename
and continue to use the filename extracted from the user-specified URL.
Prior to this change, 75d79a4 had limited etag and content-disposition
to 2xx replies only.
Tests-by: Daniel Stenberg
Reported-by: Morgan Willcock
Fixes https://github.com/curl/curl/issues/13302
Closes #13484
This commit is contained in:
parent
cb5c7039e8
commit
85efbb92b8
4 changed files with 129 additions and 3 deletions
|
|
@ -118,8 +118,9 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
|
|||
long response = 0;
|
||||
curl_easy_getinfo(per->curl, CURLINFO_RESPONSE_CODE, &response);
|
||||
|
||||
if(response/100 != 2)
|
||||
/* only care about these headers in 2xx responses */
|
||||
if((response/100 != 2) && (response/100 != 3))
|
||||
/* only care about etag and content-disposition headers in 2xx and 3xx
|
||||
responses */
|
||||
;
|
||||
/*
|
||||
* Write etag to file when --etag-save option is given.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue