hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mathis (JIRA)" <j...@apache.org>
Subject [jira] Created: (HTTPCLIENT-646) HttpClient.executeMethod with absolute URI removes the Protocol from the hostConfiguration
Date Tue, 17 Apr 2007 12:13:15 GMT
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: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message