[ 
https://issues.apache.org/jira/browse/HTTPCORE-738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Florin Slev updated HTTPCORE-738:
---------------------------------
    Description: 
It seems Apache URIBuilder encodes URL asterisk characters as %2A.

While  java.lang.URI doesn't:
 
{code:java}
    final URI uri = new URI("http", null, "localhost", 80, "/books*", null, 
null);
    final URIBuilder uribuilder = new 
URIBuilder().setScheme("http").setHost("localhost").setPort(80).setPath("/books*");
    final URI result = uribuilder.build();
    assertEquals(uri, result);
 {code}
=>
{code}
expected: <http://localhost:80/books*> but was: <http://localhost:80/books%2A>
{code}

According to www.rfc-editor.org/rfc/rfc1738.txt
{code}
Reserved:

   Usually a URL has the same interpretation when an octet is
   represented by a character and when it encoded. However, this is not
   true for reserved characters: encoding a character reserved for a
   particular scheme may change the semantics of a URL.

   Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
   reserved characters used for their reserved purposes may be used
   unencoded within a URL.
{code}

Is the asterisk encoding intended inside Apache URIBuilder ?

  was:
It seems Apache URIBuilder encodes URL asterisk characters as %2A.

While  java.lang.URI doesn't:
 
{code:java}
        final URI uri = new URI("http", null, "localhost", 80, "/books*", null, 
null);
        final URIBuilder uribuilder = new 
URIBuilder().setScheme("http").setHost("localhost").setPort(80).setPath("/books*");
        final URI result = uribuilder.build();
        assertEquals(uri, result);
 {code}
=>
{code}
expected: <http://localhost:80/books*> but was: <http://localhost:80/books%2A>
{code}

According to www.rfc-editor.org/rfc/rfc1738.txt
{code}
Reserved:

   Usually a URL has the same interpretation when an octet is
   represented by a character and when it encoded. However, this is not
   true for reserved characters: encoding a character reserved for a
   particular scheme may change the semantics of a URL.

   Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
   reserved characters used for their reserved purposes may be used
   unencoded within a URL.
{code}

Is the asterisk encoding intended inside Apache URIBuilder ?


> URIBuilder:: path with asterisk * is encoded differently compared to 
> java.lang.URI
> ----------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-738
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-738
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore
>    Affects Versions: 5.2.1
>            Reporter: Florin Slev
>            Priority: Major
>
> It seems Apache URIBuilder encodes URL asterisk characters as %2A.
> While  java.lang.URI doesn't:
>  
> {code:java}
>     final URI uri = new URI("http", null, "localhost", 80, "/books*", null, 
> null);
>     final URIBuilder uribuilder = new 
> URIBuilder().setScheme("http").setHost("localhost").setPort(80).setPath("/books*");
>     final URI result = uribuilder.build();
>     assertEquals(uri, result);
>  {code}
> =>
> {code}
> expected: <http://localhost:80/books*> but was: <http://localhost:80/books%2A>
> {code}
> According to www.rfc-editor.org/rfc/rfc1738.txt
> {code}
> Reserved:
>    Usually a URL has the same interpretation when an octet is
>    represented by a character and when it encoded. However, this is not
>    true for reserved characters: encoding a character reserved for a
>    particular scheme may change the semantics of a URL.
>    Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
>    reserved characters used for their reserved purposes may be used
>    unencoded within a URL.
> {code}
> Is the asterisk encoding intended inside Apache URIBuilder ?



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