Get File Creation Date Over HTTP

consq18 picture consq18 · Dec 1, 2010 · Viewed 8.1k times · Source

Given a file on a webserver (e.g., http://foo.com/bar.zip -> only accessible through HTTP), is there any way to get the date attributes (e.g., date [created, modified]) without downloading the entire archive in the first place?

Right now, I download the archive and read the attributes programmatically. Trouble is that the archive is dozens of MiB so it seems like a waste of resources to download the entire thing and end up reading off just a couple of bytes of information.

I realize that bandwidth is practically free, but I don't like to be wasteful in any case.

Answer

ihorko picture ihorko · Dec 1, 2010

Try to read Last-Modified from header