hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Blavins (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1294) CircularRedirectException is falsely thrown on URI case mismatch
Date Sun, 14 Apr 2013 03:16:16 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13631254#comment-13631254

Ian Blavins commented on HTTPCLIENT-1294:


There might be a bit more to it. It appears that a redirect from some-url to some-url/ (ie
the redirect adds a trailing slash) is also seen as a circular redirect and throws the exception.
You can try this by going to www.abc.net.au/digmusic with automatic following of redirects
on. This site gives three redirects in sequence (they are in the middle of a large, complex
site change): www.abc.net.au/digmusic  ==> abc.net.au/dig  ==> www.abc.net.au/dig  ==>
www.abc.net.au/dig/    (where ==> is 'redirects to'). A circular redirect exception is
thrown on the last redirect, where the trailing slash is being added. (I had to break the
sequence up and do each step manually without automatically following redirects to find where
the exception gets thrown). I can work around this by implementing a custom redirect handler
and manually adding the slash to the URI in the 2nd redirect for this particular site. I haven't
thought enough about whether I can put a general fix in this way.

> 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.1.3, 4.2.2
>            Reporter: Michiel Proce
>             Fix For: 4.3 Final
> 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
> 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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message