You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Roland Weber (JIRA)" <ji...@apache.org> on 2008/01/05 11:09:34 UTC

[jira] Closed: (HTTPCLIENT-727) Misbehaviour of URI.getEscapedPath() with uri containing double slash like //js/includes/foo.js

     [ https://issues.apache.org/jira/browse/HTTPCLIENT-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Weber closed HTTPCLIENT-727.
-----------------------------------

    Resolution: Won't Fix

Hello Marc,

your test is invalid. In absence of other delimiters, the first double slash in the URL indicates the start of the host section, not of the path. When substituting the scheme and ports for HTTP, your example URL translates to
http://js:80/includes/foo.js
and not what you seem to have expected,
http:////js/includes/foo.js
with empty host and port section.

You have to create the URL as follows:
        URI uri = new URI("////js/includes/foo.js", false);
The first // indicates the start of the host section, which is empty.
The second // is then interpreted correctly as the start of the path.

Actually, we do have this bug in other constructors, when the string is passed as a path explicitly:
        URI uri = new URI(null, null, "//js/includes/foo.js", null);
And that's surely not the only bug in there. The URI class is broken beyond repair.
Hacking in more workarounds won't make it better.

sorry,
  Roland


> Misbehaviour of URI.getEscapedPath() with uri containing double slash like //js/includes/foo.js
> -----------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-727
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-727
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>    Affects Versions: 3.1 Final
>            Reporter: Marc Guillemot
>
> public void testURI_getEscapedPath() throws Exception {
> 	URI uri = new URI("//js/includes/foo.js", false);
> 	assertEquals("//js/includes/foo.js", uri.toString()); // passes
> 	assertEquals("//js/includes/foo.js", uri.getEscapedPath()); // fails
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org