commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsde...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpConnection.java
Date Thu, 08 Aug 2002 12:51:55 GMT
jsdever     2002/08/08 05:51:55

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpConnection.java
  Log:
  Remove the runtime dependancy on JSSE
  
  Revision  Changes    Path
  1.17      +20 -11    jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java
  
  Index: HttpConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- HttpConnection.java	7 Aug 2002 02:13:22 -0000	1.16
  +++ HttpConnection.java	8 Aug 2002 12:51:55 -0000	1.17
  @@ -65,7 +65,6 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   
  -import javax.net.ssl.SSLSocketFactory;
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.OutputStream;
  @@ -73,7 +72,6 @@
   import java.net.Socket;
   import java.net.SocketException;
   import javax.net.ssl.SSLSocketFactory;
  -import javax.net.SocketFactory;
   
   
   
  @@ -344,9 +342,9 @@
                   int port = (null == _proxyHost) ? _port : _proxyPort;
                   if (isSecure() && !isProxied()) {
                       if (sslSocketFactory == null) {
  -                        sslSocketFactory = SSLSocketFactory.getDefault();
  +                        sslSocketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
                       }
  -                    _socket = sslSocketFactory.createSocket(host,port);
  +                    _socket = (new SocketCreator()).createSocket(host,port);
                       _usingSecureSocket = true;
                   } else {
                       _socket = new Socket(host,port);
  @@ -387,9 +385,9 @@
   	}
   
           if (sslSocketFactory == null) {
  -            sslSocketFactory = SSLSocketFactory.getDefault();
  +            sslSocketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
           }
  -        _socket = ((SSLSocketFactory) sslSocketFactory).createSocket(_socket, _host, _port,
true);
  +        _socket = (new SocketCreator()).createSocket(_socket, _host, _port, true);
           _input = _socket.getInputStream();
           _output = _socket.getOutputStream();
           _usingSecureSocket = true;
  @@ -731,6 +729,17 @@
           }
       }
   
  +    // -- javax.net binary isolation
  +
  +    private class SocketCreator {
  +        public Socket createSocket(Socket socket, String host, int port, boolean auto)
throws IOException {
  +            return sslSocketFactory.createSocket(socket, host, port, auto);
  +        }
  +
  +        public Socket createSocket(String host, int port) throws IOException {
  +            return sslSocketFactory.createSocket(host, port);
  +        }
  +    }
       // ------------------------------------------------------------- Attributes
   
       /** Log object for this class. */
  @@ -760,7 +769,7 @@
       /** SO_TIMEOUT value */
       private int _so_timeout = 0;
       /** An alternative factory for SSL sockets to use */
  -    private SocketFactory sslSocketFactory = null;
  +    private SSLSocketFactory sslSocketFactory = null;
       /** Whether or not the _socket is a secure one. Note the difference to _ssl */
       private boolean _usingSecureSocket = false;
       /** Whether I am tunneling a proxy or not */
  
  
  

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


Mime
View raw message