curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: --etag-save overwrites on status 304

From: Timothe Litt <litt_at_acm.org>
Date: Mon, 2 Oct 2023 13:33:36 -0400


On 02-Oct-23 13:17, Paul Gilmartin via curl-users wrote:
> I have been in the habit of using the same file as --etag-save
> and --etag-compare.  This sort of works.  However, in case of
> HTTP/1.1 304 Not Modified my --etag-compare is overwritt4n by
> an empty file and is ineffective for the next fetch.
>
> I have started making my --etag-save a temp file and renaming
> it only on success.  Is this the best approach?
>
> Would it be better if curl wrote to --etag-save only if an
> ETag: header appears, or do some users depend on the current
> behavior?
>
Curl should write the ETag header received with the 304.  Is the server
sending it?

If not, it's a server bug.

Note RFC2616 REQUIRES ETag to be sent "if it would have been sent in a
200 response to the same request".

If the server is sending it, but curl isn't writing it to the
--etag-save, it's a curl bug.

Timothe Litt
ACM Distinguished Engineer
--------------------------
This communication may not represent the ACM or my employer's views,
if any, on the matters discussed.


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-10-02