W3C home > Mailing lists > Public > uri@w3.org > July 2005

URL resolution sanity check

From: Elliotte Harold <elharo@metalab.unc.edu>
Date: Tue, 19 Jul 2005 08:25:02 -0400
Message-ID: <42DCF11E.2060503@metalab.unc.edu>
To: uri@w3.org

I need to confirm something. Consider the following situation:

<parent xml:base="http://www.example.com/data/limit/..">
   <child xml:base="test.xml"/>

Is the base URL of the child element
http://www.example.com/data/limit/test.xml or
http://www.example.com/data/test.xml ?

In other words, is http://www.example.com/data/limit/.. essentially the
same as http://www.example.com/data/limit/../ or not?

Both the algorithms in RFC 2396 and 3RFC 986 seem to indicate that the 
result is http://www.example.com/data/limit/test.xml, not 
http://www.example.com/data/test.xml. I'm not sure if:

A. I'm misreading the algorithm
B. This is a bug in the algorithm
C. This is an often unrecognized but intended consequence of the 

The problem is that both 2396 and 3986 remove the segment following the 
last slash *before* removing dot segments. Thus 
http://www.example.com/data/limit/.. and 
http://www.example.com/data/limit/../ do not get treated the same.

Perhaps there is a way out of this. If removal of dot segments were 
applied to *all* URIS, not just at the resolution step, then we could 
say that the base URI of <parent 
xml:base="http://www.example.com/data/limit/.."/> was actually 
http://www.example.com/data/, not http://www.example.com/data/limit/.. 
In this case the relative resolution works as we expect. However, I can 
find no justification for that leap in XML Base, XML Infoset, or RFC 3986.

This would affect other URIs as well. For instance, what is the base URI of

<foo xml:base="http://www.example.com/test/.././data.xml" /> ? Is it 
http://www.example.com/test/.././data.xml or 
http://www.example.com/data.xml? This one may be academic, but in the 
case I originally proposed, you could actually end up linking 
to/including/loading a different document depending on how you handle this.

I suspect similar issues apply with an HTML BASE element as well. 
Possibly there are other cases where this may apply.

Elliotte Rusty Harold  elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
Received on Tuesday, 19 July 2005 12:25:10 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:25:09 UTC