tool: support --show-headers AND --remote-header-name

By keeping the headers in memory until we know the target file name,
then output them all.

Previously this option combination would cause an error.

Add test 1310 and 1492 to verify. Adjusted test 1460 to work in the new
conditions.

Closes #15110
This commit is contained in:
Daniel Stenberg 2024-09-30 15:38:56 +02:00
parent bc6072d245
commit b0c82239c2
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
12 changed files with 240 additions and 69 deletions

View file

@ -11,33 +11,26 @@ HTTP GET
<reply>
<data nocheck="yes">
HTTP/1.1 200 swsclose
12345
fooo
54 3 2 1
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Disposition: filename=name%TESTNUMBER; charset=funny; option=strange
Content-Length: 4
hej
</data>
</reply>
#
# Client-side
<client>
# this relies on the debug feature to allow us to set directory to store the
# -J output in
<features>
Debug
</features>
<server>
http
</server>
<name>
HTTP GET with -Ji and Content-Disposition with existing file
</name>
<setenv>
CURL_TESTDIR=%LOGDIR
</setenv>
<command option="no-output,no-include">
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -Ji -O
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -Ji -O --output-dir %LOGDIR
</command>
<file name="%LOGDIR/name%TESTNUMBER">
initial content
@ -47,9 +40,9 @@ initial content
#
# Verify data after the test has been "shot"
<verify>
# Warning: --include and --remote-header-name cannot be combined.
# Warning: Failed to open the file log/name1460: File exists
<errorcode>
2
23
</errorcode>
<file name="%LOGDIR/name%TESTNUMBER">
initial content