diff options
Diffstat (limited to 'swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java')
-rw-r--r-- | swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java b/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java index b6da4a5a630c..5d7efe1cebf2 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java @@ -25,17 +25,14 @@ import java.net.Socket; import java.net.UnknownHostException; import java.security.KeyStore; import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.X509TrustManager; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; -import org.apache.commons.httpclient.ConnectTimeoutException; -import org.apache.commons.httpclient.HttpClientError; -import org.apache.commons.httpclient.params.HttpConnectionParams; -import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; -class WikiProtocolSocketFactory implements SecureProtocolSocketFactory +class WikiProtocolSocketFactory extends SSLSocketFactory { private SSLContext m_aSSLContext; @@ -105,43 +102,59 @@ class WikiProtocolSocketFactory implements SecureProtocolSocketFactory } if ( m_aSSLContext == null ) - throw new HttpClientError(); + throw new RuntimeException("failed to create SSLContext"); return m_aSSLContext; } - public Socket createSocket( String sHost, int nPort, InetAddress clientHost, int clientPort ) - throws IOException, UnknownHostException + @Override + public Socket createSocket(InetAddress address, int port) + throws IOException { - return GetNotSoSecureSSLContext().getSocketFactory().createSocket( sHost, nPort, clientHost, clientPort ); + return GetNotSoSecureSSLContext().getSocketFactory().createSocket(address, port); + } + + @Override + public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) + throws IOException + { + return GetNotSoSecureSSLContext().getSocketFactory().createSocket(address, port, localAddress, localPort); } - public Socket createSocket( final String sHost, final int nPort, final InetAddress aLocalAddress, final int nLocalPort, final HttpConnectionParams params ) - throws IOException, UnknownHostException, ConnectTimeoutException + @Override + public Socket createSocket( String sHost, int nPort, InetAddress clientHost, int clientPort ) + throws IOException, UnknownHostException { - if ( params == null ) - return createSocket( sHost, nPort, aLocalAddress, nLocalPort ); - - int nTimeout = params.getConnectionTimeout(); - Socket aSocket = GetNotSoSecureSSLContext().getSocketFactory().createSocket(); - aSocket.bind( new InetSocketAddress( aLocalAddress, nLocalPort ) ); - aSocket.connect( new InetSocketAddress( sHost, nPort ), nTimeout ); - return aSocket; + return GetNotSoSecureSSLContext().getSocketFactory().createSocket( sHost, nPort, clientHost, clientPort ); } + @Override public Socket createSocket( String sHost, int nPort ) throws IOException, UnknownHostException { return GetNotSoSecureSSLContext().getSocketFactory().createSocket( sHost, nPort ); } + @Override public Socket createSocket( Socket aSocket, String sHost, int nPort, boolean bAutoClose ) - throws IOException, UnknownHostException + throws IOException { return GetNotSoSecureSSLContext().getSocketFactory().createSocket( aSocket, sHost, nPort, bAutoClose ); } @Override + public String[] getDefaultCipherSuites() + { + return GetNotSoSecureSSLContext().getSocketFactory().getDefaultCipherSuites(); + } + + @Override + public String[] getSupportedCipherSuites() + { + return GetNotSoSecureSSLContext().getSocketFactory().getSupportedCipherSuites(); + } + + @Override public boolean equals(Object obj) { return ((obj != null) && obj.getClass().equals(WikiProtocolSocketFactory.class)); |