curl-users
Re: libcurl's treatment of `file:' and absolute paths
Date: Mon, 6 Aug 2001 13:57:12 +0200 (MET DST)
On Sun, 5 Aug 2001, Stefan Ulrich wrote:
> >> I must admit that from reading RFCs 1738 and 2396, I couldn't tell
> >> for sure whether the above URL is correct or whether it should be
> >> file://localhost//path/to/file
>
> > Both are valid URLs, but the latter example is an absolute path while the
> > first one is a relative path.
>
> sounds reasonable; but what's strange is that libwww (and also browsers
> like netscape, lynx or mozilla) *all* seem to treat an url-path with one
> `/' after `localhost' as absolute, not as relative path.
Thanks for your reports, details and patience!
It is indeed a clear indication that I am pretty lonely in my interpretation
of how to deal with the file: URLs without an initial slash. They all seem to
assume that if the "relative" paths are all specified from the root /.
(I also just noticed that libcurl treats file://localhost/tmp/data and
file:///tmp/data differently, which I figure it shouldn't.)
> > How does libwww treat the path in 'file://localhost/foo' ? as '/foo' ?
>
> Yup;
So then I suggest the attached patch to make libcurl act like "the rest". It
makes all these URLs perfectly valid and refer to the same file:
file://localhost/foo
file://localhost//foo
file:///foo
file:////foo
file://whatever/foo
Does that fit your view and the other tools' views of reality?
-- Daniel Stenberg -- curl dude -- http://curl.haxx.se/
- TEXT/PLAIN attachment: file-url.patch