[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16741899#comment-16741899
 ] 

Gary Gregory commented on HTTPCLIENT-1960:
------------------------------------------

[~michael-o] What is the alternative you propose? A new project? What else 
would be in it? Eventually that project would grow and people would ask the 
same question: I have pull in that project just to get the one class? Sure 
there is also Apache Commons Net and Commons Lang, which could be a home for 
such a class, but then what? Would you make HttoClient depend on one of those? 
I would think that a new URI class might be handy to use within HttpCore and 
HttpClient if the one provided by the JRE is so old.

> URIBuilder incorrect handling of multiple leading slashes in path component
> ---------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1960
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1960
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (async), HttpClient (classic)
>    Affects Versions: 4.5.5
>            Reporter: Raymond Cuenen
>            Assignee: Oleg Kalnichevski
>            Priority: Major
>
> If original path startsWith '/' it is removed by normalizePath; in that case 
> it should be added again URI-encoded. For example: A path value of 
> '/etc/motd' becomes:
> {code:java}
> ftp://myn...@host.dom/etc/motd{code}
> while it should be:
> {code:java}
> ftp://myn...@host.dom/%2Fetc/motd{code}
> Only when the path value is 'etc/motd' is should become 
> "ftp://myn...@host.dom/etc/motd";
>   
> Fix for this issue in URIBuilder.java:
> {noformat}
> private String buildString() {
> ...
>     if (this.encodedPath != null) {
>         sb.append(normalizePath(this.encodedPath, sb.length() == 0));
>     } else if (this.path != null) {
>         String encodedPath = encodePath(normalizePath(this.path, sb.length() 
> == 0));
>         // Start fix for paths starting with '/'
>         // If original path startsWith '/' it is removed by normalizePath; in 
> that case it should be added again URI-encoded.
>         if (this.path.startsWith("/")) {
>             encodedPath = "/%2F" + encodedPath.substring(1);
>         }
>         // End fix
>         sb.append(encodedPath);
>     }
> ...
> }{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to