Linux edwin 5.5.13-1-MANJARO #1 SMP PREEMPT Wed Mar 25 17:14:28 UTC 2020 x86_64 GNU/Linux
Discussion
After going through the pull-request #4678 that implemented using both --etag-compare and --etag-save, I understood that the --etag-save is processed first and open for writing test.etag (see
"Failed to allocate memory for custom etag header\n");
result = CURLE_OUT_OF_MEMORY;
break;
}
/* add Etag from file to list of custom headers */
add2list(&config->headers, header);
Curl_safefree(header);
if(file) {
fclose(file);
}
}
).
This results into creating test.etag if it does not exists or truncating test.etag if it exists.
Truncating test.etag then make the --etag-compare option useless.
I did this
On the first run where
test.etag
andtest.ext
does not exist:On the second run,
test.ext
is downloaded again.I expected the following
The second curl command should not download
text.ext
again.curl/libcurl version
operating system
Linux edwin 5.5.13-1-MANJARO #1 SMP PREEMPT Wed Mar 25 17:14:28 UTC 2020 x86_64 GNU/Linux
Discussion
After going through the pull-request #4678 that implemented using both
--etag-compare
and--etag-save
, I understood that the--etag-save
is processed first and open for writingtest.etag
(seecurl/src/tool_operate.c
Lines 908 to 976 in 57476a9
This results into creating
test.etag
if it does not exists or truncatingtest.etag
if it exists.Truncating
test.etag
then make the--etag-compare
option useless.I believe this behavior is a bug because it is different to the behavior described here: https://daniel.haxx.se/blog/2019/12/06/curl-speaks-etag/ where this example is given:
I would like to propose a pull-request where
--etag-compare
is processed before--etag-save
which will results in the expected behavior.I suppose curl should not fail if
--etag-compare test.etag
is specified buttest.etag
does not exist and--etag-save
is specified.Thank you for this awesome tool!
The text was updated successfully, but these errors were encountered: