Alex Dupre created HTTPCLIENT-1197:
--------------------------------------
Summary: Redirects (301 responses) to other sites (not a different
page on the same site) don't get followed.
Key: HTTPCLIENT-1197
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1197
Project: HttpComponents HttpClient
Issue Type: Bug
Affects Versions: 4.2 Final
Reporter: Alex Dupre
If a server, during a simple GET, returns http status code 301 to redirect the
client to another site, an exception is thrown instead of following the new
location. This is a major regression, since in httpclient 4.1 it was working
correctly.
=== BugTest.java ===
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
public class BugTest {
public static void main(String[] args) throws Exception {
DefaultHttpClient client = new DefaultHttpClient();
HttpGet method = new
HttpGet("http://www.mvzt.gov.si/fileadmin/mvzt.gov.si/pageuploads/pdf/informacijska_druzba/SI_TL.xml");
client.execute(method);
}
}
=== BugTest.java ===
% java BugTest
Exception in thread "main" org.apache.http.client.ClientProtocolException
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:909)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
at BugTest.main(BugTest.java:9)
Caused by: org.apache.http.HttpException: Unable to establish route: planned =
{}->http://www.arhiv.mvzt.gov.si; current = {}->http://www.mvzt.gov.si
at
org.apache.http.impl.client.DefaultRequestDirector.establishRoute(DefaultRequestDirector.java:842)
at
org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:645)
at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:480)
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
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]