Using "scheme:" with relative URLs

Roy T. Fielding (fielding@simplon.ICS.UCI.EDU)
Mon, 22 Aug 1994 17:11:18 -0700

To: "Michael A. Dolan" <miked@cerf.net>
Subject: Using "scheme:" with relative URLs
In-Reply-To: Your message of "Mon, 22 Aug 1994 10:20:05 PDT."
<199408221725.KAA11208@nic.cerf.net>
Date: Mon, 22 Aug 1994 17:11:18 -0700
From: "Roy T. Fielding" <fielding@simplon.ICS.UCI.EDU>
Message-Id: <9408221711.aa20012@paris.ics.uci.edu>

Michael A. Dolan writes:

> One area that was somewhat vague was what happens when there appears to
> be a relative URL, but the scheme is different. For example, if the
> base is <http://host/path> and you run into <ftp:path> what should
> happen ?
>
> Some options:
>
> A. Each scheme has a "base", and one could do nothing - ie it's a malformed
> (relative) URL, (this seems to be what you intended) or

Yes. A document can have only one base (per retrieval context).

> B. Schemes belonging to "Uses-Netloc" can share a base.

Not a safe assumption. The contents of <net_loc> are different for
different schemes (i.e. ftp, telnet use login info while file and http don't).
And then there is the question of the port. I think it would be better for
the client to just consider the URL invalid.

> A more likely combination might also be base=<ftp://host/path> and href=
> <file:path>.
>
> Should this be allowed to work ?

Nope.

> If not, and an HTML document contains URL's of varying schemes, then we
> need to think about how in HTML to define all their (separate) bases.

Not really. A relative URL should not normally include the scheme name.
The only case in which it is needed is when the URL path contains a
colon character before any other non-scheme characters, e.g.

ftp://myhome/pub/My_Life:_A_Short_Mystery

which (on my system) would also correspond to the location

file://localhost/usr/spool/ftp/pub/My_Life:_A_Short_Mystery

This particular URL would present a problem for a relative URL parser
if the embedded URL was "My_Life:_A_Short_Mystery", because the parser
would think that "My_Life" is a new scheme. But there are many ways
to avoid this problem, e.g. "./My_Life:_A_Short_Mystery" or even
"../pub/My_Life:_A_Short_Mystery", so there is really no need for the
scheme to appear at all in relative links (at least, none that I can think of).

For the first draft, I wanted to stick as close as possible to proven
implementations (aside from introducing the specific requirements of
Internet URLs). For the next draft, should the use of scheme: in front
of relative URLs be removed? Or, should they be allowed but with a note
added to the spec which describes the pitfalls?

....Roy Fielding ICS Grad Student, University of California, Irvine USA
(fielding@ics.uci.edu)
<A HREF="http://www.ics.uci.edu/dir/grad/Software/fielding">About Roy</A>