]> git.ipfire.org Git - thirdparty/curl.git/commit
tool_operate: don't truncate the etag save file by default
authorGusted <postmaster@gusted.xyz>
Sat, 20 Apr 2024 16:44:42 +0000 (18:44 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 23 Apr 2024 09:33:20 +0000 (11:33 +0200)
commit00bef95946d35115376cedac9a64df22e3b202ab
tree1fd1b15cd756ce652db2adf4dff61a8462a6e759
parentf8011ffa1eecffbc9b470ae06c6db5c49706d73d
tool_operate: don't truncate the etag save file by default

This fixes a regression of 75d79a4486b279100209ddf8c7fdb12955fb66e9. 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
75d79a4486b279100209ddf8c7fdb12955fb66e9 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
src/tool_cb_hdr.c
src/tool_operate.c
tests/data/Makefile.inc
tests/data/test3204 [new file with mode: 0644]