You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Chris K. Jester-Young (JIRA)" <ji...@apache.org> on 2012/05/26 05:22:22 UTC

[jira] [Created] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Chris K. Jester-Young created HTTPCLIENT-1195:
-------------------------------------------------

             Summary: 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


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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400776#comment-13400776 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

Runs OK for me locally, but it would be good to get confirmation from the next Gump run (which is what found the error).
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Jeff Lupien (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13291746#comment-13291746 ] 

Jeff Lupien commented on HTTPCLIENT-1195:
-----------------------------------------

Have you tested the fix against the example in this bug?  I'm not sure the fix as implemented will handle the cases where "=" or "&" are in the parameter names or values.  It might make sense to go back to encoding the parameter names/values in the build() method and using a different URI() constructor that doesn't do encoding for you (e.g. URI(String)).
                
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Comment Edited] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400147#comment-13400147 ] 

Sebb edited comment on HTTPCLIENT-1195 at 6/25/12 2:28 AM:
-----------------------------------------------------------

There is a problem with the URI in testEscapedAmpersandInQueryAbsolute

The URI is "/path/a=b&c=%26d", which is not actually a valid query - there is no query present.
[Later: the test cases have been fixed to use: "/path?a=b&c=%26d" which was probably the intention]

However the fact that it works for relative mode and not absolute points to some other error; the two cases ought to behave identically.
[Later: this problem disappears if the normalize method is moved as described below]
                
      was (Author: sebb@apache.org):
    There is a problem with the URI in testEscapedAmpersandInQueryAbsolute

The URI is "/path/a=b&c=%26d", which is not actually a valid query - there is no query present.

However the fact that it works for relative mode and not absolute points to some other error; the two cases ought to behave identically.
                  
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13426145#comment-13426145 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1195:
-----------------------------------------------

I am getting a different result, which looks OK to me.
---
URIBuilder builder = new URIBuilder();
builder.setScheme("http").setHost("localhost").setPath("/2011-02-01/search")
.setParameter("q", "stuff")
.setParameter("bq", "kindid:'1'");        
System.out.println(builder.toString());
---
http://localhost/2011-02-01/search?q=stuff&bq=kindid%3A%271%27
---
Can it be you still have an older version of HttpClient on the classpath?

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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401754#comment-13401754 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

Looks like this is because the same set is used to escape both userinfo and fragment but userinfo does not allow / @ ? in a URI.

There should probably be a separate set for userinfo.

Also just discovered that "[" and "]" were added to the reserved set by RFC 2732 (IPv6).
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Comment Edited] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400153#comment-13400153 ] 

Sebb edited comment on HTTPCLIENT-1195 at 6/24/12 2:15 PM:
-----------------------------------------------------------

The attached patch moves normalizePath from UriUtils to UriBuilder, and fixes all the HttpClient test failures for me.

I've not applied it because I think it needs review first.
                
      was (Author: sebb@apache.org):
    The attached patch moves normalizePath from UriUtils to UriBuilder, and fixes all the test failures for me.
                  
> 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.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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400379#comment-13400379 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

I've been looking into the space escaping issue a bit more. 
It's true that space should be escaped %20 in URLs according to RFC 2396 and RFC 3986 (which obsoletes it).

However SPACE <=> '+' escaping is used for application/x-www-form-urlencoded  [1]
This says it applies for both POST and GET.

I have tested IE, Fx, Chrome and Opera and they all use '+' to escape space when submitting a form using POST or GET.
They also all use %20 to escape space within the path. For sample form, see [2]

This seems like it might contradict the RFCs, however in 3986 the query part is allowed to contain '+' without escaping.

So I think the issue here is that different escaping is used for URIs and for form data (which may be embedded as an URI query)

It seems to me that the parameter format/parse should use space <=> '+' whereas URI encode/decode needs to use space <=> %20

[Perhaps also need to consider using escape/unescape in method names rather then encode/unencode to distinguish it from character set encoding.]

[1] http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
[2] http://people.apache.org/~sebb/postget.html
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400250#comment-13400250 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

Just realised that the encoding patch is not correct.
If the allowable (safechars) contains '+', then it does not make sense to encode space as '+'.

That is trivial to fix.

However, fixing the decode method is potentially harder, as there is currently no context for the routine to be able to distinguish a safe (unencoded) '+' from an encoded space.
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400809#comment-13400809 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1195:
-----------------------------------------------

Truth to be told I mostly relied on the content of the java.net.URI javadocs. Feel free to re-factor the class to follow the structure of RFC 2396 more closely.

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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400788#comment-13400788 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

Forgot to add: I'm not 100% sure that the UNRESERVED, PATH etc sets correspond with the RFCs. I'm still working through the list.

Is the code intended to implement RFC 2396 and/or its replacement RFC 3986?
If so, perhaps it would make sense for the constants to use the same names and hierarchy?
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Comment Edited] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399941#comment-13399941 ] 

Sebb edited comment on HTTPCLIENT-1195 at 6/24/12 12:47 PM:
------------------------------------------------------------

I've recovered TestUriEscapes.java@1349668 because it seems to still be appropriate.

The following tests fail:

testEscapedSpaceInPathAbsolute
testEscapedAmpersandInQueryAbsolute
testEscapedSpaceInQueryAbsolute

whereas the corresponding relative tests work OK.
                
      was (Author: sebb@apache.org):
    I've recovered TestUriEscapes.java@1349668 because it seems to still be appropriate.

The following tests fail:

testEscapedSpaceInPathAbsolute
testEscapedSpaceInPathAbsolute
testEscapedSpaceInQueryAbsolute

whereas the corresponding relative tests work OK.
                  
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13402085#comment-13402085 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1195:
-----------------------------------------------

Thank you, Sebastian. 

If I hear no objections I'll start cutting 4.2.1 release later today or tomorrow.

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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated HTTPCLIENT-1195:
-----------------------------

    Attachment: HTTPCLIENT-1195.patch

The attached patch moves normalizePath from UriUtils to UriBuilder, and fixes all the test failures for me.
                
> 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.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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400141#comment-13400141 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

[Found and fixed bug causing testEscapedSpaceInQueryAbsolute to fail.]
                
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Pablo Funes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13293711#comment-13293711 ] 

Pablo Funes commented on HTTPCLIENT-1195:
-----------------------------------------

See also URIUtils.createURI()

                
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400147#comment-13400147 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

There is a problem with the URI in testEscapedAmpersandInQueryAbsolute

The URI is "/path/a=b&c=%26d", which is not actually a valid query - there is no query present.

However the fact that it works for relative mode and not absolute points to some other error; the two cases ought to behave identically.
                
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Comment Edited] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400155#comment-13400155 ] 

Sebb edited comment on HTTPCLIENT-1195 at 6/25/12 2:31 AM:
-----------------------------------------------------------

The patch also fixes the failing JMeter tests that use GET requests.

However, the POST requests still have encoding issues, but that is probably not an issue with UriBuilder.

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.
                
      was (Author: sebb@apache.org):
    The patch also fixes the failing JMeter tests that use GET requests.

However, the POST requests still have encoding issues, but that is probably not an issue with UriBuilder.
                  
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400572#comment-13400572 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

Looks good.

Trivial tweak: 
I would check the boolean before comparing the byte with space; seems a more natural ordering to me and might be slightly faster.
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400719#comment-13400719 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1195:
-----------------------------------------------

> I would check the boolean before comparing the byte with space or '+' ; seems a more natural ordering to me and might be slightly faster. 

Tweak applied.

@All
Folks, if I hear no complaints I'll start the 4.2.1 release process later this week.

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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400152#comment-13400152 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

I think the problem is caused by .URIUtils.rewriteURI() which calls

uribuilder.setPath(normalizePath(uribuilder.getPath()));

normalizePath() is OK, but calling setPath() sets encodedPath to null, which means it can no longer be used.

Seems to me that the normalization should be done by UriBuilder, not tacked on externally, as that causes unwanted side effects.

I think normalizePath should be moved to UriBuilder.
                
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13401569#comment-13401569 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

java.net.URI allows the following characters without escaping them in query and fragment:

/ @ ?

However URLEncodedUtils does not allow such characters.

Is this intentional?
According to RFC 2396, query and fragment allow everything in path plus "?" (which is obviously not allowed in path) yet the safe set which is used for fragment and query excludes "?" as well as "/" and "@". That does not make sense to me.
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-1195.
-------------------------------------------

       Resolution: Fixed
    Fix Version/s: 4.2.1

Fix committed to SVN trunk. Please re-test your application against the latest SVN snapshot.

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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400535#comment-13400535 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1195:
-----------------------------------------------

Sebastian,

I changed URLEncodedUtils class to encode blanks in the query part of request URIs as '+'. Please review.

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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Nathan Maves (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13425916#comment-13425916 ] 

Nathan Maves commented on HTTPCLIENT-1195:
------------------------------------------

Late to the game but I don't think this works in the 4.2.1 release.

URIBuilder builder = new URIBuilder();
builder.setScheme("http").setHost(SEARCH_ENDPOINT).setPath("/2011-02-01/search")
.setParameter("q", query)
.setParameter("bq", "kindid:'1'")

notice the bq parameter.

The output as follows is still double encoded.

http://SEARCH_ENDPOINT/2011-02-01/search?q=thrive&bq=kindid%253A%25271%2527
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Comment Edited] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399941#comment-13399941 ] 

Sebb edited comment on HTTPCLIENT-1195 at 6/24/12 12:57 PM:
------------------------------------------------------------

I've recovered TestUriEscapes.java@1349668 because it seems to still be appropriate.

The following tests fail:

testEscapedAmpersandInPathAbsolute
testEscapedAmpersandInQueryAbsolute
testEscapedSpaceInQueryAbsolute

whereas the corresponding relative tests work OK.
                
      was (Author: sebb@apache.org):
    I've recovered TestUriEscapes.java@1349668 because it seems to still be appropriate.

The following tests fail:

testEscapedSpaceInPathAbsolute
testEscapedAmpersandInQueryAbsolute
testEscapedSpaceInQueryAbsolute

whereas the corresponding relative tests work OK.
                  
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Nathan Maves (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13426347#comment-13426347 ] 

Nathan Maves commented on HTTPCLIENT-1195:
------------------------------------------

Oleg,

You were correct.  I was using the Amazon (AWS) SDK 1.3.11 which was aldo using httpclient 4.2.1 beta 1.  Newer versions of the AWS SDK don't  have the issue.  Your code is solid.  Sorry about the false alarm.

Nathan 
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399941#comment-13399941 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

I've recovered TestUriEscapes.java@1349668 because it seems to still be appropriate.

The following tests fail:

testEscapedSpaceInPathAbsolute
testEscapedSpaceInPathAbsolute
testEscapedSpaceInQueryAbsolute

whereas the corresponding relative tests work OK.
                
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Pablo Funes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13295874#comment-13295874 ] 

Pablo Funes commented on HTTPCLIENT-1195:
-----------------------------------------

Works for me! Thanks. 
                
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Reopened] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb reopened HTTPCLIENT-1195:
------------------------------


Not sure if this is the exact cause of the problem, but the JMeter Gump build has recently started failing due to some unexpected URL handling in HC4 client trunk. 

The same tests work fine in Java and HC3.1 and with HC 4.2 GA.

One of the failing tests uses the URL:

URL=http://localhost:8081/test/somescript.jsp?title=mytitle1%3F&description=mydescription1%3F

The URL query actually generated by HC4 is

title=mytitle1?&description=mydescription1?

i.e. it looks as though the encoded parameters have been incorrectly decoded

A similar problem happens with POST requests.

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.
                
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400155#comment-13400155 ] 

Sebb commented on HTTPCLIENT-1195:
----------------------------------

The patch also fixes the failing JMeter tests that use GET requests.

However, the POST requests still have encoding issues, but that is probably not an issue with UriBuilder.
                
> 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.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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Pablo Funes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13293628#comment-13293628 ] 

Pablo Funes commented on HTTPCLIENT-1195:
-----------------------------------------

Here's a test that still fails with SVN version

@Test
	public void testUriBuilder() throws URISyntaxException {
		final String parameter1 = "parameter1";
		final String value1 = "ME&YOU";
		URIBuilder uriBuilder = new URIBuilder();
		uriBuilder.addParameter(parameter1, value1);
		URI uri = uriBuilder.build();
		URIBuilder uriBuilder2 = new URIBuilder(uri);
		final List<NameValuePair> queryParams = uriBuilder2.getQueryParams();
		Assert.assertEquals(value1,queryParams.get(0).getValue());
	}
                
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved HTTPCLIENT-1195.
------------------------------

    Resolution: Fixed

Now uses separate set for userinfo and fragment
URIBuilder now behaves the same as URI for unescaped fields, and generates the same escaped URIs in most cases apart from arbitrary queries.
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Comment Edited] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400572#comment-13400572 ] 

Sebb edited comment on HTTPCLIENT-1195 at 6/25/12 4:10 PM:
-----------------------------------------------------------

Looks good.

Trivial tweak: 
I would check the boolean before comparing the byte with space or '+' ; seems a more natural ordering to me and might be slightly faster.
                
      was (Author: sebb@apache.org):
    Looks good.

Trivial tweak: 
I would check the boolean before comparing the byte with space; seems a more natural ordering to me and might be slightly faster.
                  
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Pablo Funes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13293665#comment-13293665 ] 

Pablo Funes commented on HTTPCLIENT-1195:
-----------------------------------------

If you are going to build a String first, in order to call new URI(String) (following Jeff's advise above) I would also suggest modifying the spec of toString() to make it consistent with URI, returning the final URL string. 

This is because often times what we need out of URIBuilder is the String, not the abstract URI, so one ends up calling uriBuilder.build().toString() 

You could implement a private method called buildString()  so that build() returns new URI(buildString()) and toString() returns buildString().

                
> 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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Reopened] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski reopened HTTPCLIENT-1195:
-------------------------------------------


You are right. & and = chars in parameter names / values will not be escaped. 

I really wanted to avoid having to assemble a complete URI inside the builder and duplicating a lot of non-trivial logic from the URI class, but there appears to be no way around it.

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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated HTTPCLIENT-1195:
-----------------------------

    Attachment: HTTPCLIENT-1195-2.patch

Patch to restore special handling for space <=> '+' and revert changes to test cases.

Please review.
                
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCLIENT-1195) URIBuilder-created query strings are double-escaped

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1195?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-1195.
-------------------------------------------

    Resolution: Fixed

Fixed in SVN trunk. Please re-test / review.

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
>
>
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org