[XML-SIG] file urls in urllib
Thomas B. Passin
tpassin@home.com
Wed, 7 Mar 2001 20:37:46 -0500
Mark D. Anderson wrote -
> > > file://C:/autoexec.bat
> >
> > This mapping skips a slash for the hostname. I'm using a commercial tool,
XML
> > Authority, that is written in Java. It maps the local file:
> > C:/windows/command.com
> > to:
> > file:///C:/windows/command.com
> > This looks consistent with the example mapping of a VMS logical drive in
RFC
> > 1738:
> >...
>
> exactly. if file:///C:/autoexec.bat is correct then file:////etc/passwd
should be, regardless
> of current practice. as i mentioned, this is clarified in the direction of
the slash being
> a syntactic separator only in the nfs url rfc2224.
>
> however, i do realize current practice is for the 3-slash version for
unix-style paths.
>
The triple slash really comes from an abbreviation. The basic form is
scheme://host/path-on-host
For the file:scheme, the host is supposed to be localhost (for your own
machine), or the name of a network host if you want to refer to a file on a
network file system. you are allowed to replace "locahost" by an empty
string, so you have either
file://localhost/path-on-local-machine
or
file:///path-on-local-machine
So far, so good. The problem comes in when you ask what is the path for
windows? You could use an opaque path, wherein the entire path is not to be
parsed by the url handler. This should give you file:urls like this, which is
completely compatible with both the old and the new rfc:
1) file:///c:\temp\file_url.txt
Or you could use the parsable form, which uses forward slashes, which is also
compatible with the rfcs:
2) file:///c:/temp/file_url.txt
The rfcs don't allow a form with no slashes after the scheme's colon. But
it's common enough that it might be worthwhile to support it anyway.
Double or quadruple slashes should be disallowed. To see this, just imagine
that you restore the "localhost" host name, or some other network host name.
It just doesn't work unless you have three slashes.
My recommendation is to allow both 1) and 2), and also possibly (needs more
discussion) to allow the form
file:c:\temp\file_url.txt
Cheers,
Tom P