hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amy de Buitléir" <...@nualeargais.ie>
Subject Finding out the URL after a redirect
Date Tue, 11 Nov 2008 04:34:45 GMT
Is there a way to find out what URL a request was redirected to? Here's the
scenario:

1. My code (client) does a GET http:/a/b/x
2. Server redirects to http://a/b/c/x (HttpClient handles the redirect)
3. Parsing the page, my code finds a link with a relative URL, "../y".
4. My code thinks the base URL is http:/a/b/x, so it resolves the partial
URL in the link to http:/a/y and tries to fetch that page.
    HOWEVER, the base URL is really http://a/b/c/x, so the link is really to
http://a/b/y.

If there were some way to check for redirects, then my code could cope with
them. When I was using HttpClient 3, I used to handle the redirects in my
code, so I could continue to do that if necessary. However, HttpClient 4
seems to handle redirects better than HttpClient 3 did, and I'd like to take
advantage of that.

I believe I'm asking the same question as was asked here:
http://mail-archives.apache.org/mod_mbox/hc-httpclient-users/200810.mbox/browser.
I have read the replies to that post, however, I don't think those replies
really addressed the scenario. If there isn't currently a way to find out
the redirected URL, then perhaps I should enter a feature request. Thanks in
advance for any suggestions.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message