develooper Front page | perl.libwww | Postings from October 2019

Re: retrieving date of remote object

Thread Previous | Thread Next
From:
Bradley Dean
Date:
October 22, 2019 00:46
Subject:
Re: retrieving date of remote object
Message ID:
346a71b8-eb32-49e6-9e17-06ee29bc6144@www.fastmail.com
> I note there is an option to set if-modified-since as well a to get
> a cache-freshness value in getting back a response, but the cachefreshness
> value seems to always return 1, as it is the number of seconds
> old since the item was retrieved.

Using if-modified-since relies on the server you're querying supporting that - but if you do use it you set If-Modified-Since (see: https://tools.ietf.org/html/rfc7232#section-3.3) and if you receive a HTTP 304 Not Modified the remote object was not newer than your requested date (see: https://tools.ietf.org/html/rfc7232#section-4.1).

> Anyone know the call/header value to use for getting at the remote
> object's last-modified time directly?

You can check what headers are available by using a HEAD request before you GET - then you can make the call to download or not.

Cheerio,

 Brad


On Tue, 22 Oct 2019 11:08 +11:00, L A Walsh <astara@tlinx.org> wrote:
> I'm downloading packages for my distro into a cache area on my local
> system.
> 
> I note there is an option to set if-modified-since as well a to get
> a cache-freshness value in getting back a response, but the cachefreshness
> value seems to always return 1, as it is the number of seconds
> old since the item was retrieved.
> 
> Thing it, I'd like to get the time& date stamp on the remote item.
> 
> Is there some header value that contains the time (in epoch seconds)
> for the remote item?
> 
> I am also familiar with a variant of the 'GET' method -- 'mirror' which
> will set the value of my copy to that on the remote -- so something
> must have the actual time stamp of the remote object.
> 
> I'm just not sure what call or interface I need to use to get at
> it directly.
> 
> While the 'mirror' option might be good in the long term, until I'm
> sure all my bits and pieces fit together I'd like to be able to
> display the local and remote time stamps on the object.
> 
> Anyone know the call/header value to use for getting at the remote
> object's last-modified time directly?
> 
> Thanks!
>

-- 
Bradley Dean
Email: bjdean@bjdean.id.au Skype: skype@bjdean.id.au
Mobile(Aus): +61-413014395 WWW: http://bjdean.id.au/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About