HttpClient.executeMethod with absolute URI removes the Protocol from the
hostConfiguration
------------------------------------------------------------------------------------------
Key: HTTPCLIENT-646
URL: https://issues.apache.org/jira/browse/HTTPCLIENT-646
Project: HttpComponents HttpClient
Issue Type: Bug
Components: HttpClient
Affects Versions: 3.1 RC1
Reporter: Thomas Mathis
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());
}
....
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]