[
https://issues.apache.org/jira/browse/HTTPCLIENT-1968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16757308#comment-16757308
]
Jay Modi commented on HTTPCLIENT-1968:
--------------------------------------
I'm in agreement with [~reschke]. The paths are indeed different. The encoded
path should be passed to the web server for decoding, which is why httpd has an
[option|https://httpd.apache.org/docs/2.4/mod/core.html#allowencodedslashes]
for this. The web server can then make the decision on how to handle the
request.
A forward slash is a *reserved* character and by decoding the reserved
character, the meaning of the path changes; so you are referencing a different
resource than the one the application is using the client to retrieve. If you
want a concrete example of a popular application where this is used,
elasticsearch uses encoded slashes within paths for [date
math|https://www.elastic.co/guide/en/elasticsearch/reference/current/date-math-index-names.html].
By decoding the slash, the requested resource is entirely different.
> Encoded forward slashes are not preserved when rewriting URI
> ------------------------------------------------------------
>
> Key: HTTPCLIENT-1968
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1968
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Affects Versions: 4.5.7
> Reporter: Jay Modi
> Priority: Major
> Attachments: rewrite_preserve_forward_slash.diff
>
>
> URIs that contain an encoded forward slash (%2F) are no longer preserved when
> the HTTP client executes. I came across this when upgrading from 4.5.2 to
> 4.5.7 and my requests that contained an encoded forward slash suddenly
> started failing. The appears to be due to decoding and re-encoding of the
> path that takes place in the URIUtils#rewriteURI method. I've attached a
> patch that restores the old behavior but if a URI contains two slashes in a
> row in addition to an encoded slash the encoded forward slash will be decoded.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]