hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magnus Gustavsson (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HTTPCLIENT-1193) Regression causing issues with cross-site redirects
Date Fri, 25 May 2012 14:34:23 GMT
Magnus Gustavsson created HTTPCLIENT-1193:
---------------------------------------------

             Summary: Regression causing issues with cross-site redirects
                 Key: HTTPCLIENT-1193
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1193
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient
    Affects Versions: 4.2 Final
            Reporter: Magnus Gustavsson


The release version of HttpClient 4.2 introduces a regression with cross-site redirects that
didn't exist previously.

According to Oleg Kalnichevski in HTTPCLIENT-1185: "There is unfortunately a bug in the BasicClientConnectionManager
introduced in 4.2 causing issues with cross-site redirects."


For example, the following code

import java.io.IOException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

public class BadRequest {
    public static void main(String[] args) {
	try {
	    HttpClient httpclient = new DefaultHttpClient();
	    HttpGet httpget = new HttpGet("http://www.edu.mah.se/KK3231/syllabus/");
	    System.out.println(httpclient.execute(httpget).getStatusLine().getStatusCode());
	} catch (IOException e) {
	    e.printStackTrace();
	}
    }
}

raises an exception as follows:

% java BadRequest     
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 BadRequest.main(BadRequest.java:13)
Caused by: org.apache.http.HttpException: Unable to establish route: planned = {}->http://edu.mah.se;
current = {}->http://www.edu.mah.se
	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)
	... 3 more


--
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message