You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Sven (JIRA)" <ji...@apache.org> on 2019/05/16 08:37:00 UTC

[jira] [Comment Edited] (HTTPCLIENT-1968) Encoded forward slashes are not preserved when rewriting URI

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

Sven edited comment on HTTPCLIENT-1968 at 5/16/19 8:36 AM:
-----------------------------------------------------------

In our project when upgrading from Spring Boot 2.1.3.RELEASE to 2.1.4.RELEASE (using http-client 4.5.8) our URL building no longer works as expected:
{code:java}
URI returnUrl = builder.setPath("https://localhost:1234/path1/path2).addParameter("param1", param1).addParameter("param2", "param2")
 .addParameter("param3, "param3").addParameter("param4", "param4").build();{code}
In version 4.5.7 this returned: [https://localhost:1234/path1/path2?param1=param|https://localhost:1234/path1/path2?param1=param2]1 etc

In version 4.5.8 it now returns: */*[https://localhost:1234/path1/path2?param1=param1] etc which is obviously not a correct URL.

Should I change something in the way I build this URI or use another object?


was (Author: clauw):
In our project when upgrading from Spring Boot 2.1.3.RELEASE to 2.1.4.RELEASE (using http-client 4.5.8) our URL building no longer works as expected:

URI returnUrl = builder.setPath("https://localhost:1234/path1/path2).addParameter("param1", param1).addParameter("param2", "param2")
 .addParameter("param3, "param3").addParameter("param4", "param4").build();

In version 4.5.7 this returned: [https://localhost:1234/path1/path2?param1=param|https://localhost:1234/path1/path2?param1=param2]1 etc

In version 4.5.8 it now returns: */*[https://localhost:1234/path1/path2?param1=param1] etc which is obviously not a correct URL.

Should I change something in the way I build this URI or use another object?

> 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
>             Fix For: 4.5.8, 5.0 Beta4
>
>         Attachments: rewrite_preserve_forward_slash.diff
>
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org