mirror of
https://github.com/curl/curl.git
synced 2026-08-25 11:23:39 +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
62
tests/data/test473
Normal file
62
tests/data/test473
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP GET
|
||||
</keywords>
|
||||
</info>
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data nocheck="yes">
|
||||
HTTP/1.1 301 funky chunky!
|
||||
Server: fakeit/0.9 fakeitbad/1.0
|
||||
Location: /redirected
|
||||
Transfer-Encoding: chunked
|
||||
Trailer: chunky-trailer
|
||||
Connection: mooo
|
||||
ETag: W/"asdf"
|
||||
|
||||
40
|
||||
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||
30
|
||||
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
21;heresatest=moooo
|
||||
cccccccccccccccccccccccccccccccc
|
||||
|
||||
0
|
||||
chunky-trailer: header data
|
||||
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
Check if --etag-save saved correct etag to a file on 301
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --etag-save %LOGDIR/etag%TESTNUMBER
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
GET /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
User-Agent: curl/%VERSION
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
<file name="%LOGDIR/etag%TESTNUMBER">
|
||||
W/"asdf"
|
||||
</file>
|
||||
</verify>
|
||||
|
||||
</testcase>
|
||||
Loading…
Add table
Add a link
Reference in a new issue