Michiel Proce created HTTPCLIENT-1294:
-----------------------------------------

             Summary: CircularRedirectException is falsely thrown on URI case 
mismatch
                 Key: HTTPCLIENT-1294
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1294
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 4.2.2, 4.1.3
            Reporter: Michiel Proce
            Priority: Minor


Some servers (including IIS6) redirect wrong-cased request URIs to lower case:
http://EXAMPLE.com/ -> http://example.com/

Now when I'm redirected from another URI to an uppercase URI, the following 
redirects happen:
http://referrer.com/ -> http://EXAMPLE.com/ -> http://example.com/

When running this request with HttpClient (with default 
ALLOW_CIRCULAR_REDIRECTS: false), I get a 
org.apache.http.client.CircularRedirectException, even though a circular 
redirect won't occur.

The problem lies in java.net.URI, the following URIs are considered equal:
URI a = new URI("http://example.com";);
URI b = new URI("http://EXAMPLE.com";);
// a.equals(b): true
// a.hashCode() == b.hashCode(): true

The redirect locations are stored in a HashSet<URI> in 
org.apache.http.impl.client.RedirectLocations. A CircularRedirectException is 
thrown when an URI is already in this hashset.

I have no real suggestions on how to fix this, because I am not known with the 
coding style for HttpClient..

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to