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: Naming ETag files?

From: Timothe Litt <litt_at_acm.org>
Date: Sat, 14 Jan 2023 15:57:19 -0500

On 14-Jan-23 13:21, Daniel Stenberg via curl-users wrote:
> On Thu, 12 Jan 2023, Paul Gilmartin via curl-users wrote:
>
>> I would like to save my --etag-compare and --etag-save (probably the
>> same name) files with names generated from the --remote-header-name;
>> perhaps as simple as "$remote-header-name.ETag".  Is there an orderly
>> and reliable way to do this?
>
> No there isn't. With some clever thinking maybe we can offer this in
> the future!
>
>> As an alternative, is it possible to use "--write-out
>> %{filename_effective}" without actually downloading the resource?  I
>> could then use "$filename_effective.ETag" to name my ETags.
>
> Having "${variables}" work more broadly would be cool but tricky since
> they are all available/done at different point in times, and generally
> safe to get *after* the transfer is complete...
>
I'd much rather see command lines get shorter and simpler than longer.

Rather than more command line clutter, consider that dotfiles are a
convenient place to store metadata.

As a useful special case, you could make --etag-xxx .  (e.g. --etag-save
'.') save/read the data in .<filename>.

For -save, it's pretty straightforward, since you have the filename when
you need it.  For -compare, you'd have to assume that the filename is
the last path segment, which seems reasonable.

There probably is other metadata that would be useful, so (at least in
this case), format the file so it can hold it.

e.g. accept something like:

etag="tag1"
etag=W/"weakly-tag2"
UsedHttpVersion="4"
LastDownLoadTime="4 centuries"
MailToWhenFails="daniel_at_haxx.se"
MissingBytes="512-1023,4096-16383"

A file without any etag= lines would have the same meaning as todaze
empty file - you don't send 'If-None-Match., and/or you didn't receive
an E-Tag.

Clever enough?

I'd like to see this be the default, with --no-etag to allow disabling
it.  (I don't know why, other than testing.  Well, maybe someone who
keeps their own metadata in .<filename>? So ".curl_<filename>"?)  Just
doing the right thing (optimizing transfer) without making the user
specify how should be the default.  (Like the --httpn direction.)

P.S. I'm not proposing the sample non-etag metadata; just observing that
it's wise to allow for future creativity.

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/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2023-01-14