Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
3.1 RC1
-
None
-
None
Description
Testprogram (snippet):
public void test() throws IOException
{
String url = "https://www.somehost.com/somepath";
URL u = new URL(url);
Protocol protocol = new Protocol("https", new AcceptAllSSLProtocolSocketFactory(), port);
HttpClient httpClient = new HttpClient();
httpClient.getHostConfiguration().setHost(u.getHost(), port, protocol);
GetMethod m = new GetMethod(url);
httpClient.httpClient.executeMethod(m);
System.out.println("status=" + m.getStatusCode());
}
Suggested fix in method public int executeMethod(HostConfiguration hostconfig, final HttpMethod method, final HttpState state)
....
// make a deep copy of the host defaults
hostconfig = (HostConfiguration) hostconfig.clone();
if (uri.isAbsoluteURI()) {
//hostconfig.setHost(uri); <-- this line replaces the Protocol with the default one
hostconfig.setHost(uri.getHost(), uri.getPort(), hostconfig.getProtocol());
}
....