On Thu, 2008-02-28 at 11:08 +0100, Johannes Koch wrote:
> Hi,
> 
> recently I discovered that java.net.URI.resolve(String str) does not 
> work properly according to RFC 2396 (or 3986) when resolving an empty 
> URI reference ("").
> 
> The result from resolving "" against the base URI "http://a/b/c/d;p?q"; 
> should be the same URI ("http://a/b/c/d;p?q";), but is "http://a/b/c/";.
> 
> 
> 
> RFC 2396 section 5.2:
>     2) If the path component is empty and the scheme, authority, and
>        query components are undefined, then it is a reference to the
>        current document and we are done.
> 
> and Appendix C:
> Within an object with a well-defined base URI of
> 
>        http://a/b/c/d;p?q
> 
>     the relative URI would be resolved as follows:
> with C.2
> [...]
>     An empty reference refers to the start of the current document.
> 
>        <>            =  (current document)
> 
> 
> 
> RFC 3986 section 5.2.2:
>              if (R.path == "") then
>                 T.path = Base.path;
>                 if defined(R.query) then
>                    T.query = R.query;
>                 else
>                    T.query = Base.query;
>                 endif;
> 
> and section 5.4:
> Within a representation with a well defined base URI of
> 
>        http://a/b/c/d;p?q
> 
>     a relative reference is transformed to its target URI as follows.
> with section 5.4.1
> [...]
> 
>        ""              =  "http://a/b/c/d;p?q";
> 
> 
> 
> new URL(URL context, String spec) works better in this case, but it 
> keeps the context URL's fragment identifier if defined, which as I read 
> the RFCs is not correct.
> 
> Does this have any relevance in HttpComponents?

Johannes,

Is java.net.URI.resolve(String str) being used anywhere in HttpClient?
If so, what do you suggest we do?

Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to