commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r326188 - in /jakarta/commons/proper/httpclient/trunk: ./ src/java/org/apache/commons/httpclient/HttpConnection.java
Date Tue, 18 Oct 2005 18:11:31 GMT
Author: olegk
Date: Tue Oct 18 11:11:20 2005
New Revision: 326188

URL: http://svn.apache.org/viewcvs?rev=326188&view=rev
Log:
PR #37129 (User-defined ProtocolSocketFactory for secure connection through proxy)

Changelog:
* HttpConnection changed to use a protocol socket factory registered for 'http' protocol instead
of DefaultProtocolSocketFactory when tunneling secure connections through a proxy

Contributed by Oleg Kalnichevski
Reviewed by Roland Weber and Ortwin Gl├╝ck

Modified:
    jakarta/commons/proper/httpclient/trunk/   (props changed)
    jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HttpConnection.java

Propchange: jakarta/commons/proper/httpclient/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Oct 18 11:11:20 2005
@@ -1,3 +1,4 @@
+
 dist
 build.properties
 target
@@ -8,3 +9,4 @@
 bin
 classes
 log4j-tests.properties
+.settings

Modified: jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HttpConnection.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HttpConnection.java?rev=326188&r1=326187&r2=326188&view=diff
==============================================================================
--- jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HttpConnection.java
(original)
+++ jakarta/commons/proper/httpclient/trunk/src/java/org/apache/commons/httpclient/HttpConnection.java
Tue Oct 18 11:11:20 2005
@@ -697,10 +697,13 @@
                 usingSecureSocket = isSecure() && !isProxied();
                 // use the protocol's socket factory unless this is a secure
                 // proxied connection
-                final ProtocolSocketFactory socketFactory =
-                    (isSecure() && isProxied()
-                            ? new DefaultProtocolSocketFactory()
-                            : protocolInUse.getSocketFactory());
+                ProtocolSocketFactory socketFactory = null;
+                if (isSecure() && isProxied()) {
+                    Protocol defaultprotocol = Protocol.getProtocol("http");
+                    socketFactory = defaultprotocol.getSocketFactory();
+                } else {
+                    socketFactory = this.protocolInUse.getSocketFactory();
+                }
                 this.socket = socketFactory.createSocket(
                             host, port, 
                             localAddress, 0,



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


Mime
View raw message