Michael Becke wrote:
But what exactly is the correct behaviour? At least two major browsers implement this behaviour in a different way than you would immediately expect. This could just be a bug in them, or it could be a legitimate ambiguity. To clarify, which of the following do you interpret as the correct behaviour?
["base" + "rel" = "abs"]
A:
"http://www.foo.com/foop.html" + "" = "http://www.foo.com/foop.html"
"http://www.foo.com/foop.html" + "#" = "http://www.foo.com/foop.html"
B:
"http://www.foo.com/foop.html" + "" = "http://www.foo.com/foop.html"
"http://www.foo.com/foop.html" + "#" = "http://www.foo.com/foop.html#"
[ ... ]
[ ... ]
HttpClient:
"http://www.foo.com/foop.html" + "" = "http://www.foo.com/foop.html"
"http://www.foo.com/foop.html" + "#" = "http://www.foo.com/foop.html"
It would seem that HttpClient is doing A. Note that I just did a cvs update right now and didn't apply any patches, so I may have missed some code that is pending.
This behavior looks correct. It seems that the empty case was fixed yesterday.
After further inspection of the rfc, it would seem B is actually correct. The relevant part is:
rfc2396, section 5.2
"7) ...
if fragment is defined then
append "#" to result
append fragment to result
return result
Note that we must be careful to preserve the distinction between a
component that is undefined, meaning that its separator was not
present in the reference, and a component that is empty, meaning
that the separator was present and was immediately followed by the
next component separator or the end of the reference."
In the case of "#" it would seem this has a defined fragment component
which is empty (with all other components undefined).
Presumably then, for the above case of "#", I should be comparing the URIs using URI.getURIReference() of both the resolved base and the expected absolute value ie not URI.toString() of each?Incidentally, when I tried a relative URI of "#foop" I got the following:
"http://www.foo.com/foop.html" + "#foop" = "http://www.foo.com/foop.html"
Surely this is incorrect?
This is something I ran across as well. The fragment is not dropped, but is left out of the standard URI. To get the full URI you have to use URI.getURIReference().
--
Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]