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

Oleg Kalnichevski resolved HTTPCLIENT-2012.
-------------------------------------------
    Resolution: Duplicate

> URIBuilder#setPathSegments Doesn't URL-encode Reserved Characters
> -----------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2012
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2012
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient (classic)
>    Affects Versions: 4.5.9
>            Reporter: Michael Kuredjian
>            Priority: Major
>
> I found this bug while debugging a failing WireMock test, but the gist is as 
> follows:
>  
> Generate a request which has reserved, but encoded, characters in the path, 
> for example:
>  
> `http://localhost:8080/api/1234%3A1a2b3c/action`
>  
> This request will be properly encoded when being sent to HTTPClient via 
> Spring's resttemplate. Since request normalization is enabled by default, the 
> request URI is torn down and re-constructed; however, when expanding the path 
> segments, the `%3A` is decoded to a colon `:`, and when the path segments are 
> reconstituted via #setPathSegments, the reserved character isn't re-encoded, 
> resulting in an improperly formatted outbound request. 
>  
> I believe this can be mitigated via disabling normalization in the request 
> context; however, it's a nasty surprise. 
>  
> The offending lines appear to be 219-228 in URIUtils.java for version 4.5.9 
> (version I tested with).



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to