You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Oleg Kalnichevski (Jira)" <ji...@apache.org> on 2019/08/20 09:52:00 UTC
[jira] [Resolved] (HTTPCLIENT-2012) URIBuilder#setPathSegments
Doesn't URL-encode Reserved Characters
[ 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org