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] Commented: (HTTPCLIENT-928) Can't get list of redirect locations
Date Thu, 01 Apr 2010 08:49:27 GMT

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

Oleg Kalnichevski commented on HTTPCLIENT-928:
----------------------------------------------

What can be done pretty easily is changing the RedirectLocations class to use LinkedHashSet
instead of HashSet, which would preserve the natural sequence of redirects. This, however,
would not help with cyclic redirects.  Another possibility would be to maintain a list of
redirect locations in the RedirectLocations in addition to the set.

Would that solve the problem for you?

Oleg

> Can't get list of redirect locations
> ------------------------------------
>
>                 Key: HTTPCLIENT-928
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-928
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>    Affects Versions: 4.0.1
>            Reporter: Ryan Stewart
>
> HttpClient does a great job of following redirects, but afterward there doesn't seem
to be any way to see the URLs that it followed in the redirect chain. They are stored internally
by the DefaultRedirectHandler in the HttpContext in an attribute named "http.protocol.redirect-locations",
but the RedirectLocations object that contains them stores them in a Set, so there's no way
of knowing in what order the URLs were visited.
> Here's an example of why I need it:
> 1) Use HttpClient to retrieve http://foo.com
> 2) http://foo.com returns a 301 redirect to http://foo.com/bar, so HttpClient follows
the redirect and returns the page to me
> 3) http://foo.com/bar refers to a relative resource like "baz.html".
> That relative resource should resolve to "http://foo.com/bar/baz.html". I only know that,
though, if I can look at the redirect URL that HttpClient got in step 2. Currently, I don't
seem to be able to do that.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message