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

ASF subversion and git services commented on HTTPCORE-770:
----------------------------------------------------------

Commit aec14c48e34523ccfc6309d78028d13bb3179184 in httpcomponents-core's branch 
refs/heads/master from Arturo Bernal
[ https://gitbox.apache.org/repos/asf?p=httpcomponents-core.git;h=aec14c48e ]

HTTPCORE-770: Introduced `plusAsBlank` parameter for dynamic configuration

- Added `plusAsBlank` flag to `URIBuilder` to dynamically configure whether '+' 
should be interpreted as a space in query parameters.
- Implemented `setPlusAsBlank` method to update the flag and re-parse the query 
accordingly.


> org.apache.hc.core5.net.URIBuilder - Allow to configure plusAsBlank
> -------------------------------------------------------------------
>
>                 Key: HTTPCORE-770
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-770
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 5.3
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 5.4-alpha1
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> When upgrading from Http Client v4 to v5 then the URIBuilder has changed a 
> default value for the plusAsBlank option.
>  
> In v4 the default is true
>  
> org.apache.http.client.utils.URLEncodedUtils.decodeFormFields()
> ~~~
> return urlDecode(content, charset != null ? charset : Consts.UTF_8, true);
> ~~~
> In v5 the default is changed to false
> org.apache.hc.core5.net.URIBuilder.digestURI()
> ~~~
> this.queryParams = parseQuery(uri.getRawQuery(), charset, false);
> ~~~
>  
> I wonder if the URIBuilder could have some kind of flag that can be set to 
> set whether to use true or false.
>  
> import org.apache.hc.core5.http.NameValuePair;
> import org.apache.hc.core5.http.message.BasicNameValuePair;
> import org.apache.hc.core5.net.URIBuilder;
>  
>         URIBuilder uriBuilder;
>         uriBuilder = new 
> URIBuilder("[http://dummy/demo+demo?sample=sample+sample]";);
>         LOG.info("uri="+uriBuilder.toString());
>         List<NameValuePair> queryParameters = uriBuilder.getQueryParams();
>         queryParameters.add(new BasicNameValuePair("Greeting", "hello"));
>         uriBuilder.setParameters(queryParameters);
>         LOG.info("uri="+uriBuilder.toString());



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to