Hello,
I'm currently trying to call an URL that works fine in IE, Firefox
and Chrome but gives me a CircularRedirectException with HttpClient.
First of all, here is a small test case:
public static void main(String[] args) throws
ClientProtocolException, IOException {
HttpClientBuilder clientBuilder = HttpClients.custom();
clientBuilder.setRedirectStrategy(new
LaxRedirectStrategy());
CloseableHttpClient httpclient = clientBuilder.build();
String url =
"http://www.mediafire.com/?yx5bjvfxvkk89hj/Sheena.QOTJ-
84).part4.rar";
HttpRequestBase request = new HttpGet(url);
httpclient.execute(request);
}
After checking with Wireshark, this is apparently what happens:
1. "/?yx5bjvfxvkk89hj/Sheena.QOTJ-84).part4.rar" gets called.
2. We get a 301 response with the location
"/download/yx5bjvfxvkk89hj/Sheena.QOTJ-84%29.part4.rar"
3. "/download/yx5bjvfxvkk89hj/Sheena.QOTJ-84).part4.rar" gets
called.
4. We get the same 301 response again.
Notice that in step 3 there is a ) in the URL while the response
specifies %29 instead. Browsers do not make this conversion and get
the correct web page instead.
Could you kindly tell me if I'm doing anything wrong?
Regards,
DSA
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]