jira-importer opened a new issue, #1153:
URL: https://github.com/apache/httpcomponents-core/issues/1153

   **[Torsten 
Rendelmann](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=torstenr)**
 opened 
**[HTTPCORE-628](https://issues.apache.org/jira/browse/HTTPCORE-628?redirect=false)**
 and commented
   
   If we build an URI using java.lang.URI, the encoding of the query parameters 
are different compared to build the URI using URIBuilder. The URIBuilder uses 
e.g. "+" to encode spaces (by default) while java.lang.URI uses (the expected) 
"%20" hex encoding for spaces.
   
   Test that show the problem:
   
   ```java
   @Test
   public void testAddParameterEncodingEquivalence() throws Exception {
       final URI uri = new URI("http", null, "localhost", 80, "/",
               "param=stuff with spaces", null);
       final URIBuilder uribuilder = new 
URIBuilder().setScheme("http").setHost("localhost").setPort(80).setPath("/").addParameter(
               "param", "stuff with spaces");
       final URI result = uribuilder.build();
       Assert.assertEquals(uri, result);
   }
   ```
   
   Think, there is a platform mismatch the URIBuilder is thought to be used: 
the current implementation focus on server site to build URI to be used in http 
post/put; not for a simple http get as it is also been used on client site (by 
browsers, or vaadin apps). Would be fine if we could control the use target 
from outsite; e.g. as a build() call parameter, or separate buildUrlEncoded() 
using "%20" and build() use the current implementation?
   
   
   ---
   
   **Affects:** 5.0
   
   **Issue Links:**
   - [HTTPCORE-739](https://issues.apache.org/jira/browse/HTTPCORE-739) 
org.apache.hc.core5.net.URIBuilder does not decode plus characters (`+`) in the 
query part
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to