curl: return error if etag options are used with multiple URLs

And document it.

Add tests 484 and 485

Fixes #15729
Reported-by: Tamir Duberstein
Closes #15731
This commit is contained in:
Daniel Stenberg 2024-12-12 17:03:59 +01:00
parent 0439499170
commit a300879b63
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 113 additions and 6 deletions

View file

@ -78,7 +78,7 @@ test444 test445 test446 test447 test448 test449 test450 test451 test452 \
test453 test454 test455 test456 test457 test458 test459 test460 test461 \
test462 test463 test467 test468 test469 test470 test471 test472 test473 \
test474 test475 test476 test477 test478 test479 test480 test481 test482 \
test483 \
test483 test484 test485 \
test490 test491 test492 test493 test494 test495 test496 test497 test498 \
test499 test500 test501 test502 test503 test504 test505 test506 test507 \
test508 test509 test510 test511 test512 test513 test514 test515 test516 \

44
tests/data/test484 Normal file
View file

@ -0,0 +1,44 @@
<testcase>
<info>
<keywords>
HTTP
etags
</keywords>
</info>
#
# Server-side
<reply>
</reply>
#
# Client-side
<client>
<server>
none
</server>
<name>
Use --etag-compare and -save with more than one URL
</name>
<command>
http://example.com/%TESTNUMBER --etag-compare %LOGDIR/etag%TESTNUMBER --etag-save %LOGDIR/etag%TESTNUMBER --url http://example.net/fooo
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<errorcode>
2
</errorcode>
<stderr mode="text">
curl: The etag options only work on a single URL
curl: option --url: is badly used here
%if manual
curl: try 'curl --help' or 'curl --manual' for more information
%else
curl: try 'curl --help' for more information
%endif
</stderr>
</verify>
</testcase>

44
tests/data/test485 Normal file
View file

@ -0,0 +1,44 @@
<testcase>
<info>
<keywords>
HTTP
etags
</keywords>
</info>
#
# Server-side
<reply>
</reply>
#
# Client-side
<client>
<server>
none
</server>
<name>
Use --etag-compare and -save with more than one URL, URLs specified first
</name>
<command>
http://example.com/%TESTNUMBER http://example.net/fooo --etag-save %LOGDIR/etag%TESTNUMBER
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<errorcode>
2
</errorcode>
<stderr mode="text">
curl: The etag options only work on a single URL
curl: option --etag-save: is badly used here
%if manual
curl: try 'curl --help' or 'curl --manual' for more information
%else
curl: try 'curl --help' for more information
%endif
</stderr>
</verify>
</testcase>