file:/ vs file://<host>/ vs file:///

Daniel Veillard veillard at
Thu Nov 4 17:02:16 EET 2004

On Thu, Nov 04, 2004 at 11:45:36PM +1100, Glenn McGrath wrote:
> The file-uri-spec says that "file:/<path>" shouldnt be used as it isnt
> correct according to RFC1738.
> The file-uri-spec says we should use file://localhost/<path> or
> file:///<path>
> RFC2396 says the format of a URI is
> absoluteURI = scheme ":" ( hier_part | opaque_part )
> hier_part = ( net_path | abs_path ) [ "?" query ]
> net_path = "//" authority [ abs_path ]
> abs_path = "/"  path_segments
> Clearly file:/<path> is compatable with RFC2396
> The "//" seperator is meant to represent a network location. I think its
> very unlikely that the file scheme would be used with a remote host, so
> it doenst make much sense. Using "localhost" or not specifying a host as
> a way of trying to negating the meaning of "//" is confusing and not
> necessary.
> As "//localhost" is a net_path redirected to the the local machine, why
> not just use "/", the abs_path, it seems it was designed for this
> purpose.

  no. RFC2396 does not override RFC1738 on the matter of defining the
protocol schemes.

"it revises and replaces the generic definitions in RFC 1738 and RFC 1808."

  the the protocols descriptions are not the generic part.

   Hence section 3.10 of RFC1738 is still the normative
reference (that's lame but nobody went to update that at the IETF), and
it is defined as:

3.10 FILES

   The file URL scheme is used to designate files accessible on a
   particular host computer. This scheme, unlike most other URL schemes,
   does not designate a resource that is universally accessible over the

   A file URL takes the form:


   where <host> is the fully qualified domain name of the system on
   which the <path> is accessible, and <path> is a hierarchical
   directory path of the form <directory>/<directory>/.../<name>.

   For example, a VMS file


   might become


   As a special case, <host> can be the string "localhost" or the empty
   string; this is interpreted as `the machine from which the URL is
   being interpreted'.

   The file URL scheme is unusual in that it does not specify an
   Internet protocol or access method for such files; as such, its
   utility in network protocols between hosts is limited.

  i.e. file:/foobar is *not* a file URL.

> I suggest the file-uri-spec be updated or removed as it only adds more
> confusion which is counter productive to the purpose of any spec.

  that would be in direct conflict with the current state of the RFC at the
IETF (unless someone can point to an RFC overriding 1738 on the matter of
the "file" protocol description).


Daniel Veillard      | Red Hat Desktop team
veillard at  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

More information about the xdg mailing list