hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HTTPCLIENT-1641) CircularRedirect due to rebuilding URI after decoding path, etc.
Date Sat, 18 Apr 2015 10:44:58 GMT

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

Oleg Kalnichevski resolved HTTPCLIENT-1641.
-------------------------------------------
       Resolution: Not A Problem
    Fix Version/s:     (was: 4.5)

Nick,
HttpClient behavior is correct and compliant with the HTTP spec and RFC 3986. Both parens
and ampersand are legal in path elements and do not need to be escaped. The server side script
is in the wrong here by forcing the clients to escape characters that do not need to be escaped.

URIUtils code was too complex and made it difficult to understand what was going on. I simplified
and optimized #resolve and related methods and also added a test case testing correctness
of the implementation. Feel free to review
http://svn.apache.org/r1674480 

I am going to close the issue as Not A Problem. I hope you will not object to that. You can
still make HttpClient handle redirects differently by using a custom redirect strategy.

Oleg

> CircularRedirect due to rebuilding URI after decoding path, etc.
> ----------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1641
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1641
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.3.5
>            Reporter: Nick Trown
>            Priority: Minor
>
> When I use HttpClient for the following URL the DefaultRedirectStrategy fails to build
a redirected URI properly.
> http://hotpads.com/apartments/Camelot-Apartments-(-Drexel-&-UPenn-)-Philadelphia-PA-19104--3phq8mahfzya3
> The reason is that the redirect URL returned is:
> /apartments/Camelot-Apartments-%28-Drexel-%26-UPenn-%29-Philadelphia-PA-19104--3phq8mahfzya3
> ** Note: the only difference is that the redirect URL has the parens encoded.
> The DefaultDirectEncoder does get the redirect URL, and since it is not absolute eventually
calls URIUtils.resolve().  This then calls normalizeSyntax() where the bug is.
> In normalizeSyntax() the URI is reconstructed.  However, it incorrectly uses getPath(),
getFragment(), etc.  instead of the raw equivalents such as getRawPath(), getRawFragment(),
etc.
> In this case, the getPath() returned is therefore:
> apartments/Camelot-Apartments-(-Drexel-&-UPenn-)-Philadelphia-PA-19104--3phq8mahfzya3
> Where the parens are back.  The DefaultRedirectStrategy detects this as a circular redirect.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message