Relative URLs (again)

Bert Freudenberg bert at isg.cs.uni-magdeburg.de
Mon Apr 2 08:34:24 UTC 2001


On Fri Mar 16, 2001, I wrote:

> Btw, it's always okay to specify the protocol, even in a relative URL
> like this: "file:foo/bar".

Actually, I was wrong. RFC 2396 says

      If the scheme component is defined, indicating that the reference
      starts with a scheme name, then the reference is interpreted as an
      absolute URI and we are done.  Otherwise, the reference URI's
      scheme is inherited from the base URI's scheme component.

      Due to a loophole in prior specifications [RFC1630], some parsers
      allow the scheme name to be present in a relative URI if it is the
      same as the base URI scheme.  Unfortunately, this can conflict
      with the correct parsing of non-hierarchical URI.  For backwards
      compatibility, an implementation may work around such references
      by removing the scheme if it matches that of the base URI and the
      scheme is known to always use the <hier_part> syntax.  The parser
      can then continue with the steps below for the remainder of the
      reference components.  Validating parsers should mark such a
      misformed relative reference as an error.

So "file:foo/bar" is invalid, as is even "http:/somedir/somefile".
Netscape 4 and other browsers tolerate this, while Mozilla nowadays does
not. I was about to file a bug report but found this:

	http://bugzilla.mozilla.org/show_bug.cgi?id=22251 

The "bug" gets reported quite often, as there are a number of web sites
using such wrong adresses - but the Mozilla developers decided to not
un-fix the browser but let the page authors fix their pages.

-- Bert





More information about the Squeak-dev mailing list