curl/tests/data/test3204
Gusted 00bef95946
tool_operate: don't truncate the etag save file by default
This fixes a regression of 75d79a4486. The
code in tool-operate truncated the etag save file, under the assumption
that the file would be written with a new etag value. However since
75d79a4486 that might not be the case
anymore and could result in the file being truncated when --etag-compare
and --etag-save was used and that the etag value matched with what the
server responded. Instead the truncation should not be done when a new
etag value should be written.

Test 3204 was added to verify that the file with the etag value doesn't
change the contents when used by --etag-compare and --etage-save and
that value matches with what the server returns on a non 2xx response.

Closes #13432
2024-04-23 11:33:20 +02:00

53 lines
875 B
Plaintext

<testcase>
<info>
<keywords>
HTTP
HTTP GET
</keywords>
</info>
#
# Server-side
<reply>
<data>
HTTP/1.1 304 Not Modified
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
ETag: "21025-dc7-39462498"
</data>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<name>
Use --etag-compare and --etag-save on an existing file
</name>
<file name="%LOGDIR/etag%TESTNUMBER">
"21025-dc7-39462498"
</file>
<command>
http://%HOSTIP:%HTTPPORT/%TESTNUMBER --etag-compare %LOGDIR/etag%TESTNUMBER --etag-save %LOGDIR/etag%TESTNUMBER
</command>
</client>
# Verify that the file still exists with the correct etag value.
<verify>
<protocol>
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
If-None-Match: "21025-dc7-39462498"
</protocol>
<file name="%LOGDIR/etag%TESTNUMBER">
"21025-dc7-39462498"
</file>
</verify>
</testcase>