You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Carlo Bertoldi <ca...@ubiquity.it> on 2012/11/30 17:52:23 UTC
Double encoding problem with URIBuilder
Hello, I'm using Httpclient 4.2,
and I think I've found a bug in the URIBuilder.
This is the toString of an URIBuilder object:
URI [scheme=http, userInfo=null, host=127.0.0.1, port=9091,
path=/changeMsisdn.jsp, queryParams=[OldMsisdn,
NewMsisdn=+393473334570], fragment=null]
Look at the NewMsisdn parameter, now let's convert it to an URL with the
URIBuilder:
URL url = builder.build().toURL();
This is the URL I get:
http://127.0.0.1:9091/changeMsisdn.jsp?OldMsisdn&NewMsisdn=%252B393473334570
Clearly the number should have been %2B393473334570 but the % sign is
encoded once more to %25.
Cheers,
Carlo
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: Double encoding problem with URIBuilder
Posted by Gary Gregory <ga...@gmail.com>.
If you have a reproducible JUnit test case based on HttpClient 4.2.2,
please create a JIRA and attach a udiff patch to it.
On Fri, Nov 30, 2012 at 12:44 PM, Gary Gregory <ga...@gmail.com>wrote:
> There is no HttpClient 4.2.3 (yet). There is a HttpCore 4.2.3, which might
> have led to the confusion.
>
> Gary
>
>
> On Fri, Nov 30, 2012 at 12:07 PM, Carlo Bertoldi <
> carlo.bertoldi@ubiquity.it> wrote:
>
>> Ok, I apologize, I've found this: https://issues.apache.org/**
>> jira/browse/HTTPCLIENT-1195<https://issues.apache.org/jira/browse/HTTPCLIENT-1195>
>>
>> So it's been solved. So I've tried updating my pom to download version
>> 4.2.3:
>>
>> <dependency>
>> <groupId>org.apache.**httpcomponents</groupId>
>> <artifactId>httpclient</**artifactId>
>> <version>4.2.3</version>
>> </dependency>
>>
>> But the file doesn't seem to exist:
>> [ERROR] Failed to execute goal on project gestorepull-war: Could not
>> resolve dependencies for project it.ubiquity.gestorepull.war:**gestorepull-war:war:1.0:
>> Failure to find org.apache.httpcomponents:**httpclient:jar:4.2.3 in
>> http://repo1.maven.org/maven2 was cached in the local repository,
>> resolution will not be reattempted until the update interval of central has
>> elapsed or updates are forced -> [Help 1]
>>
>> I've also tried downloading versione 4.2.1 and 4.2.2, same result.
>>
>> I wouldn't like to install the library manually in my repository.
>> Is there any alternative solution?
>>
>> Cheers,
>> Carlo
>>
>>
>> On 30/11/12 17:52, Carlo Bertoldi wrote:
>>
>>> Hello, I'm using Httpclient 4.2,
>>> and I think I've found a bug in the URIBuilder.
>>>
>>> This is the toString of an URIBuilder object:
>>>
>>> URI [scheme=http, userInfo=null, host=127.0.0.1, port=9091,
>>> path=/changeMsisdn.jsp, queryParams=[OldMsisdn,
>>> NewMsisdn=+393473334570], fragment=null]
>>>
>>> Look at the NewMsisdn parameter, now let's convert it to an URL with the
>>> URIBuilder:
>>> URL url = builder.build().toURL();
>>>
>>> This is the URL I get:
>>> http://127.0.0.1:9091/**changeMsisdn.jsp?OldMsisdn&**
>>> NewMsisdn=%252B393473334570<http://127.0.0.1:9091/changeMsisdn.jsp?OldMsisdn&NewMsisdn=%252B393473334570>
>>>
>>>
>>> Clearly the number should have been %2B393473334570 but the % sign is
>>> encoded once more to %25.
>>>
>>> Cheers,
>>> Carlo
>>>
>>>
>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: httpclient-users-unsubscribe@**hc.apache.org<ht...@hc.apache.org>
>>> For additional commands, e-mail: httpclient-users-help@hc.**apache.org<ht...@hc.apache.org>
>>>
>>>
>>>
>>>
>>
>> --
>> Ubiquity - A little bit forward
>> *Carlo Bertoldi*
>> Ubiquity
>> Via Teodosio 65 - 20131, Milano
>> Fisso: +39 02 288584.36 - Fax: +39 02 2829795
>> Email: carlo.bertoldi@ubiquity.it
>> Website: www.ubiquity.it
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@**hc.apache.org<ht...@hc.apache.org>
>> For additional commands, e-mail: httpclient-users-help@hc.**apache.org<ht...@hc.apache.org>
>>
>>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
> Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: Double encoding problem with URIBuilder
Posted by Gary Gregory <ga...@gmail.com>.
There is no HttpClient 4.2.3 (yet). There is a HttpCore 4.2.3, which might
have led to the confusion.
Gary
On Fri, Nov 30, 2012 at 12:07 PM, Carlo Bertoldi <carlo.bertoldi@ubiquity.it
> wrote:
> Ok, I apologize, I've found this: https://issues.apache.org/**
> jira/browse/HTTPCLIENT-1195<https://issues.apache.org/jira/browse/HTTPCLIENT-1195>
>
> So it's been solved. So I've tried updating my pom to download version
> 4.2.3:
>
> <dependency>
> <groupId>org.apache.**httpcomponents</groupId>
> <artifactId>httpclient</**artifactId>
> <version>4.2.3</version>
> </dependency>
>
> But the file doesn't seem to exist:
> [ERROR] Failed to execute goal on project gestorepull-war: Could not
> resolve dependencies for project it.ubiquity.gestorepull.war:**gestorepull-war:war:1.0:
> Failure to find org.apache.httpcomponents:**httpclient:jar:4.2.3 in
> http://repo1.maven.org/maven2 was cached in the local repository,
> resolution will not be reattempted until the update interval of central has
> elapsed or updates are forced -> [Help 1]
>
> I've also tried downloading versione 4.2.1 and 4.2.2, same result.
>
> I wouldn't like to install the library manually in my repository.
> Is there any alternative solution?
>
> Cheers,
> Carlo
>
>
> On 30/11/12 17:52, Carlo Bertoldi wrote:
>
>> Hello, I'm using Httpclient 4.2,
>> and I think I've found a bug in the URIBuilder.
>>
>> This is the toString of an URIBuilder object:
>>
>> URI [scheme=http, userInfo=null, host=127.0.0.1, port=9091,
>> path=/changeMsisdn.jsp, queryParams=[OldMsisdn,
>> NewMsisdn=+393473334570], fragment=null]
>>
>> Look at the NewMsisdn parameter, now let's convert it to an URL with the
>> URIBuilder:
>> URL url = builder.build().toURL();
>>
>> This is the URL I get:
>> http://127.0.0.1:9091/**changeMsisdn.jsp?OldMsisdn&**
>> NewMsisdn=%252B393473334570<http://127.0.0.1:9091/changeMsisdn.jsp?OldMsisdn&NewMsisdn=%252B393473334570>
>>
>>
>> Clearly the number should have been %2B393473334570 but the % sign is
>> encoded once more to %25.
>>
>> Cheers,
>> Carlo
>>
>>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@**hc.apache.org<ht...@hc.apache.org>
>> For additional commands, e-mail: httpclient-users-help@hc.**apache.org<ht...@hc.apache.org>
>>
>>
>>
>>
>
> --
> Ubiquity - A little bit forward
> *Carlo Bertoldi*
> Ubiquity
> Via Teodosio 65 - 20131, Milano
> Fisso: +39 02 288584.36 - Fax: +39 02 2829795
> Email: carlo.bertoldi@ubiquity.it
> Website: www.ubiquity.it
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@**hc.apache.org<ht...@hc.apache.org>
> For additional commands, e-mail: httpclient-users-help@hc.**apache.org<ht...@hc.apache.org>
>
>
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: Double encoding problem with URIBuilder
Posted by Carlo Bertoldi <ca...@ubiquity.it>.
Ok, I apologize, I've found this:
https://issues.apache.org/jira/browse/HTTPCLIENT-1195
So it's been solved. So I've tried updating my pom to download version
4.2.3:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.2.3</version>
</dependency>
But the file doesn't seem to exist:
[ERROR] Failed to execute goal on project gestorepull-war: Could not
resolve dependencies for project
it.ubiquity.gestorepull.war:gestorepull-war:war:1.0: Failure to find
org.apache.httpcomponents:httpclient:jar:4.2.3 in
http://repo1.maven.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of central
has elapsed or updates are forced -> [Help 1]
I've also tried downloading versione 4.2.1 and 4.2.2, same result.
I wouldn't like to install the library manually in my repository.
Is there any alternative solution?
Cheers,
Carlo
On 30/11/12 17:52, Carlo Bertoldi wrote:
> Hello, I'm using Httpclient 4.2,
> and I think I've found a bug in the URIBuilder.
>
> This is the toString of an URIBuilder object:
>
> URI [scheme=http, userInfo=null, host=127.0.0.1, port=9091,
> path=/changeMsisdn.jsp, queryParams=[OldMsisdn,
> NewMsisdn=+393473334570], fragment=null]
>
> Look at the NewMsisdn parameter, now let's convert it to an URL with the
> URIBuilder:
> URL url = builder.build().toURL();
>
> This is the URL I get:
> http://127.0.0.1:9091/changeMsisdn.jsp?OldMsisdn&NewMsisdn=%252B393473334570
>
>
> Clearly the number should have been %2B393473334570 but the % sign is
> encoded once more to %25.
>
> Cheers,
> Carlo
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
>
--
Ubiquity - A little bit forward
*Carlo Bertoldi*
Ubiquity
Via Teodosio 65 - 20131, Milano
Fisso: +39 02 288584.36 - Fax: +39 02 2829795
Email: carlo.bertoldi@ubiquity.it
Website: www.ubiquity.it
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org