[
https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400366#comment-13400366
]
Oleg Kalnichevski commented on HTTPCLIENT-1195:
-----------------------------------------------
> There used to be a unit test for URIs (client.protocol.TestUriEscapes), but
> that was dropped with the fixes for this issue - I'm not
> sure where URIs are supposed to be tested now.
Some of the test cases in TestUriEscapes make no sense as you discovered as
well. Besides, TestUriEscapes relies on the local HTTP server to test
functionality that can be perfectly tested with simple unit tests. URI building
and URL encoding aspects should be unit tested in TestURIBuilder and
TestURIUtils classes and not in the integration tests.
> However the fact that it works for relative mode and not absolute points to
> some other error; the two cases ought to behave identically.
This is actually quite expected. Only absolute request URIs need to rewritten
and converted into relative ones plus 'Host' header as required by the HTTP
specification.
> I think normalizePath should be moved to UriBuilder.
Agreed. This makes sense.
> HTTPCLIENT-1195.patch
The patch looks good to me. I probably would move path normalization from
#digestURI() to #buildString(), though. That would also eliminate the need to
invoke #normilizePath twice. Please go ahead and commit the patch.
> JMeter expects spaces to be encoded as '+' - as is done by Java and HC3.1 -
> but spaces are now being encoded as %20 in post bodies.
I found no evidence of such encoding being legal in the RFC 2396. It can well
be that URL coded POST forms are still being governed by some older RFC. What
we could do is to convert white spaces to %20 in request URIs and to '+' in
POST forms for compatibility sake.
> If the allowable (safechars) contains '+', then it does not make sense to
> encode space as '+'.
Precisely.
Oleg
> URIBuilder-created query strings are double-escaped
> ---------------------------------------------------
>
> Key: HTTPCLIENT-1195
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1195
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient
> Affects Versions: 4.2 Final
> Environment: java version "1.6.0_24"
> OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3)
> OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
> Reporter: Chris K. Jester-Young
> Fix For: 4.2.1
>
> Attachments: HTTPCLIENT-1195-2.patch, HTTPCLIENT-1195.patch
>
>
> When setting parameters in URIBuilder, the keys and values are
> double-escaped: once in URIBuilder.build(), and again in
> URI.appendSchemeSpecificPart(). Example:
> URIBuilder ub = new URIBuilder("http://www.google.com/");
> ub.addParameter("foo=bar", "baz&qux");
> ub.build(); // http://www.google.com/?foo%253Dbar=baz%2526qux
> In order to avoid this problem, URIBuilder.build() should use URI's
> one-argument constructor, which does not try to do extra escaping.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]