Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting modification time of HTTP and FTP files

1 view
Skip to first unread message

Ben Bucksch

unread,
Sep 8, 2002, 7:25:11 AM9/8/02
to mozilla...@mozilla.org
For 4.x-like roaming, (I think) I need to check, if the local file is
newer/older than the file on the server before down/upload.

I didn't find an API to get the time when the file/resource on the HTTP
and FTP server was last modified. I can get to the raw HTTP headers
(probably same for FTP), but of course I'd like to avoid parsing them in
my code. My code is mostly protocol-agnostic right now and I'd like to
keep it that way.

Did I overlook some way to get to that info? If not, would it be
reasonable to put that into Necko? Who do you think should the API looks
like; most importantly, which interface should contain the method(s)?


Andreas Otte

unread,
Sep 8, 2002, 10:20:28 AM9/8/02
to
Ben Bucksch wrote:
> For 4.x-like roaming, (I think) I need to check, if the local file is
> newer/older than the file on the server before down/upload.
>
> I didn't find an API to get the time when the file/resource on the HTTP
> and FTP server was last modified. I can get to the raw HTTP headers

I think this is currently the only way possible for HTTP.

> (probably same for FTP), but of course I'd like to avoid parsing them in

The only way I can think of for ftp is to read the listing of the
directory, send it through the nsFTPDirListingConv code and grab the
date of the right file. No headers here ...

> my code. My code is mostly protocol-agnostic right now and I'd like to
> keep it that way.
>
> Did I overlook some way to get to that info? If not, would it be
> reasonable to put that into Necko? Who do you think should the API looks
> like; most importantly, which interface should contain the method(s)?

I think that would be a completly new interface that can/should be
implemented for each protocol.

Andreas

Bradley Baetz

unread,
Sep 8, 2002, 10:36:03 AM9/8/02
to
On Sun, 08 Sep 2002 16:20:28 +0200, Andreas Otte wrote:
>
> The only way I can think of for ftp is to read the listing of the
> directory, send it through the nsFTPDirListingConv code and grab the
> date of the right file. No headers here ...

You could QI to nsIResumableChannel, and try to get teh resumable entity,
which has the timestamp on it. Since FTP doesn't know if a server allows
resuming wihtout trying it, I think it returns resumable entities for
every file.

Maybe we need an nsIMetaInfo interface, or something....

Bradley

Doug Turner

unread,
Sep 10, 2002, 12:05:03 AM9/10/02
to bba...@student.usyd.edu.au

nsIFile implementations!

Doug Turner
do...@netscape.com

Bradley Baetz

unread,
Sep 10, 2002, 1:32:08 AM9/10/02
to
On Mon, 09 Sep 2002 21:05:03 -0700, Doug Turner wrote:

> nsIFile implementations!

Exposing some of the nsIFile information on a more generic interface would
be a good idea, as long as there is some way of telling the caller 'no
idea' when asked for a particular attribute.

Bradley

Christian Biesinger

unread,
Sep 22, 2002, 6:45:56 AM9/22/02
to
Bradley Baetz wrote:
> as long as there is some way of telling the caller 'no
> idea' when asked for a particular attribute.

like NS_ERROR_NOT_IMPLEMENTED?

Bradley Baetz

unread,
Sep 22, 2002, 11:57:47 AM9/22/02
to

Yes, as long as it was documented that that 'error' code wasn't really an
error in that case.

Bradley

0 new messages