[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-commons-dev
Subject:    DO NOT REPLY [Bug 38423]  New:  - HttpClient ignores hostconfiguration Protocol
From:       bugzilla () apache ! org
Date:       2006-01-27 17:53:43
Message-ID: bug-38423-13697 () http ! issues ! apache ! org/bugzilla/
[Download RAW message or body]

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38423>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38423

           Summary: HttpClient ignores hostconfiguration Protocol
           Product: HttpClient
           Version: 3.0 Final
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Commons HttpClient
        AssignedTo: httpclient-dev@jakarta.apache.org
        ReportedBy: dangleton@crossflo.com


If a custom Protocol is configured in the client's HostConfiguration and the url
is absolue, the Protocol is ignored and the custom socketfactory is never used.
This makes the handling of self signed certificates as per documentation
impossible without registering a custom protocol or a generic handler for the
protocol. This functionality worked with version 2.0.2.

offending code seems to be initiated in HttpClient method
public int executeMethod(HostConfiguration hostconfig, 
        final HttpMethod method, final HttpState state)
...
if (hostconfig == defaulthostconfig || uri.isAbsoluteURI()) {
            // make a deep copy of the host defaults
            hostconfig = new HostConfiguration(hostconfig);
            if (uri.isAbsoluteURI()) {
                hostconfig.setHost(uri);
            }
        }
...

What is happening is that hostconfig.setHost(uri) resets the Protocol with 
    public synchronized void setHost(final URI uri) {
        try {
            setHost(uri.getHost(), uri.getPort(), uri.getScheme());
        } catch (URIException e) {
            throw new IllegalArgumentException(e.toString());
        }
    }

which eventually calls new HttpHost(host, port, Protocol.getProtocol(protocol));
resulting in the resetting of the Protocol. 

if this really needs to be done, I would suggest using the call
setHost(final String host, int port, final Protocol protocol)
instead.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic