W3C home > Mailing lists > Public > uri@w3.org > April 2004

Re: More test cases to be confirmed

From: Roy T. Fielding <fielding@gbiv.com>
Date: Tue, 6 Apr 2004 17:56:38 -0700
Cc: <uri@w3.org>
To: Graham Klyne <gk@ninebynine.org>
Message-Id: <6CD3C294-882E-11D8-9CC7-000393753936@gbiv.com>

On Thursday, February 19, 2004, at 07:00  AM, Graham Klyne wrote:
> More questions arising from my implementation work...
> I have a revised parser based on the revised spec, except for some 
> details of dot-segment normalization, that passes a pretty wide range 
> of test cases.  Currently, with respect to the queries below, I do 
> "what I would expect" rather than what the spec. currently says.

> (1)
> Base:   "http://example.com/path?query#frag"
> Ref:    ""   (empty URI)
> Result: "http://example.com/path?query"

That is what the spec says.

> (2)
> Base:   "foo:a"
> Ref:    "b/c"
> Result: "foo:b/c"

That is what the spec says.

> (3)
> Although it's a marginal case, I find myself in disagreement with the 
> way the current spec seems to treat this case:
> Base:   "foo:a"
> Ref:    "../b/c"
> Result: "foo:/b/c"
> (based on bullet 2 of section 5.2.4)
> I think it would be more consistent (and it's also what software I 
> wrote in the past does) in this case to return:
> Result: "foo:../b/c"
> My argument about this being more consistent is based on the fact that 
> it seems fine in other cases for the result to be a relative URI; e.g.
> Base:   foo:a/b
> Ref:    c/d
> Result: a/c/b
> so why not when the leading segment happens to be '../'?

Because "../" refers to the level above and the topmost level in
a hierarchy is usually the root.  I don't expect that to ever happen
in practice except when someone is deliberately intending to insert
bad data, so the safer alternative is to remove the dots.

> (4)
> Base:   "foo:a"
> Ref:    "./b/c"
> Result: "foo:b/c"
> This is not strictly according to RFC2396bis, which I think would have 
> the value returned be:
> Result: "foo:/b/c"
> I think "./b/c" should be treated as equivalent to "b/c", hence the 
> result returned should be the same as test case (2) above.

If the reference were "./", then would the answer be "foo:" or foo:/".
What about "./bar"?  I could rationalize this and say that a path not
beginning with "/" has the first segment as its root label, but I have
a hard time deciding that one is better than the other.

> (5)
> Base:   "foo://a//b/c"
> Ref:    "../../d
> Result: "foo://a/d"

That is what the spec says.

> (6)
> Base:   "http://a/b/c/d;p?q"
> Ref:    "/../g"
> Result: "http://a/g"     (according to spec)
> Result: "http://a/../g"  (what I'd expect, see above)

The authors made a decision that dot-segments are to be removed
from all paths, not just relative ones, for the sake of consistency,
security, and the ability to round-trip relative-to-absolute-to-relative

Received on Tuesday, 6 April 2004 21:10:48 UTC

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