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: [email protected]
        ReportedBy: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to