cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: If-Modified-Since fields not always in GMT

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 17 Apr 2001 10:02:22 +0200 (MET DST)

On Fri, 13 Apr 2001, Phil Karn wrote:

> I'm writing some scripts that use Curl 6.0.

Oh, you should upgrade. That version is more than... (checking) 18 months
old!

> I just discovered that when you use the --time-cond option, curl will
> generate an HTTP "If-Modified-Since" header in the local timezone (in my
> case, PDT).

Ouch. What an oversight on my behalf! :-/

> A quick workaround is to set the environment variable TZ to "GMT0" in the
> shell script that calls curl, but this really ought to be fixed inside
> curl itself.

That's a good workaround indeed, and yes, it will be fixed within (lib)curl.
I won't bother posting a patch though, as you won't be able to apply it on
your ancient version! ;-)

(Checked in a fixed lib/http.c a few minutes ago.)

> A related comment: Curl should set the modification timestamp of the
> local output file to the header timestamp in the incoming HTTP reply from
> the server

That's a feature I've had in the TODO file for a quite some time now. libcurl
actually provides an interface for applications to extract that time stamp.

If you add this, please post the patch!

> and there should be an easier way than "--time-cond filename" to specify
> a conditional get that fetches the remote file only if it is newer than
> the local copy.

Then, how would that interface look like?

> In fact, this conditional get should arguably be the default behavior for
> all fetches.

Possibly, but many fetches don't use a target file and then it isn't possible
for curl to know the document date.

Also, it is very easy to write a wrapper script for curl that purpose. I've
always tried to keep curl to do the basic stuff by default, and then you
optionally add more advanced behaviour.

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
Received on 2001-04-17