Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 20667
Status: resolved
Priority: 0/
Queue: libwww-perl

People
Owner: Nobody in particular
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 5.805
Fixed in: (no value)



Subject: LWP::UserAgent::mirror should compare Last-Modified header to timestamp
Yesterday I discovered that $ua->mirror does not work the way I expected in the case when the HTTP Server *ignores* the If-Modified-Since header. If the HTTP server sends a 200 response and a Last-Modified header of a time that is older than the local copy, mirror overwrites the local file with the older downloaded content. The documentation says: If the document on the server has not changed since this time, then nothing happens. Clearly the behaviour is not exactly matching the documentation. The question is, if you see it as a bug and how you would like it being fixed. I would think that the downloaded content should be discarded when the Last-Modified header signifies an older file than the local copy.
From: MARKSTOS [...] cpan.org
On Tue Jul 25 01:41:55 2006, ANDK wrote: Show quoted text
> Yesterday I discovered that $ua->mirror does not work the way I expected > in the case when the HTTP Server *ignores* the If-Modified-Since header. > > If the HTTP server sends a 200 response and a Last-Modified header of a > time that is older than the local copy, mirror overwrites the local file > with the older downloaded content. > > The documentation says: > > If the document on the server has not changed since > this time, then nothing happens. > > Clearly the behaviour is not exactly matching the documentation. The > question is, if you see it as a bug and how you would like it being fixed. > > I would think that the downloaded content should be discarded when the > Last-Modified header signifies an older file than the local copy.
For servers that behave like this, it would be more efficient to do just a HEAD, notice the Last-Modified header, and not to a GET at all. However, for well-behaved servers, doing an additional HEAD before the GET to mirror is a waste. Whether or the the document is discarded seems a less important point, since the network traffic (the "hard work") has already happened.
CC: ANDK [...] cpan.org
Subject: Re: [rt.cpan.org #20667] LWP::UserAgent::mirror should compare Last-Modified header to timestamp
Date: Wed, 02 Aug 2006 08:38:17 +0200
To: bug-libwww-perl [...] rt.cpan.org
From: andreas.koenig.gmwojprw [...] franz.ak.mind.de (Andreas J. Koenig)
Show quoted text
>>>>> On Tue, 01 Aug 2006 18:52:52 -0400, " via RT" <bug-libwww-perl@rt.cpan.org> said:
Show quoted text
Show quoted text
> On Tue Jul 25 01:41:55 2006, ANDK wrote:
>> Yesterday I discovered that $ua->mirror does not work the way I expected >> in the case when the HTTP Server *ignores* the If-Modified-Since header. >> >> If the HTTP server sends a 200 response and a Last-Modified header of a >> time that is older than the local copy, mirror overwrites the local file >> with the older downloaded content. >> >> The documentation says: >> >> If the document on the server has not changed since >> this time, then nothing happens. >> >> Clearly the behaviour is not exactly matching the documentation. The >> question is, if you see it as a bug and how you would like it being fixed. >> >> I would think that the downloaded content should be discarded when the >> Last-Modified header signifies an older file than the local copy.
Show quoted text
> For servers that behave like this, it would be more efficient to do just > a HEAD, notice the Last-Modified header, and not to a GET at all. > However, for well-behaved servers, doing an additional HEAD before the > GET to mirror is a waste.
Yes, this is how I re-programmed it, because I know exactly which server I'm talking to (Perlbal). Show quoted text
> Whether or the the document is discarded seems a less important point, > since the network traffic (the "hard work") has already happened.
The way I got bitten was that my local file was overwritten by the older file from the server and that surprised me and does not fit to the description "nothing happens". It's a judgement call which behaviour people would expect in this case and it's not a frequent situation,,,, hmmm. Thanks, -- andreas