cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How can I get Directory listing with HTTP

From: Jochen Roderburg <Roderburg_at_uni-koeln.de>
Date: Tue, 18 May 2010 11:07:35 +0200

Zitat von Kamil Dudka <kdudka_at_redhat.com>:

> On Tue May 18 2010 10:01:10 Avinash wrote:
>> Basically my requirement is to get the metadata of file pointed by HTTP URL
>> and not the actual file.
>>
>> e.g if my URL is
>>
>> http://172.20.241.206/HTTP_Share/performance_data/mixed/pdf/6.pdf
>>
>> Then I do not want to download the file 6.pdf, but the metadata of 6.pdf
>> like its size, access time, modification time etc.
>>
>> Is there any way to get all this meta-information without actually
>> downloading it ?
>
> I don't think you understand. The HTTP protocol doesn't know anything about
> 'file', 'atime' and 'mtime'. Under some circumstance you may know the size
> of file from the HTTP header, but it is not guaranteed either. You should
> realize that the thing you call file, doesn't even need to exist on the
> server's file system. It can be e.g. generated on-the-fly by a script on
> the remote site.
>
> Kamil

Yes, that is of course the real complete truth for this question too. ;-)

But now here for practical purposes: "if" the URL corresponds to a
real file on the server, most HTTP servers nowadays return the
filesize and the modification date in the HTTP response headers.

J.Roderburg

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-18