cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/4.3 to 66027f4
Date Thu, 05 Feb 2015 10:20:19 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.3 6a07aed6d -> 66027f43b


improve protocol enabling based on socket object type

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit d62d511f47ae8118544259b15c9382185364052e)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	plugins/network-elements/opendaylight/src/main/java/org/apache/cloudstack/network/opendaylight/api/NeutronRestApi.java
	utils/src/com/cloud/utils/rest/RESTServiceConnector.java


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/66027f43
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/66027f43
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/66027f43

Branch: refs/heads/4.3
Commit: 66027f43bb772601fb9a35aa03112785b8c6aee4
Parents: 6a07aed
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Thu Feb 5 15:48:21 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Thu Feb 5 15:49:53 2015 +0530

----------------------------------------------------------------------
 .../ssl/EasySSLProtocolSocketFactory.java       | 30 ++++++++++++++------
 1 file changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/66027f43/utils/src/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java
b/utils/src/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java
index 76ea8da..8941ed0 100644
--- a/utils/src/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java
+++ b/utils/src/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java
@@ -135,8 +135,10 @@ public class EasySSLProtocolSocketFactory implements SecureProtocolSocketFactory
 
     @Override
     public Socket createSocket(String host, int port, InetAddress clientHost, int clientPort)
throws IOException, UnknownHostException {
-        SSLSocket socket = (SSLSocket) getSSLContext().getSocketFactory().createSocket(host,
port, clientHost, clientPort);
-        socket.setEnabledProtocols(SSLUtils.getSupportedProtocols(socket.getEnabledProtocols()));
+        Socket socket = getSSLContext().getSocketFactory().createSocket(host, port, clientHost,
clientPort);
+        if (socket instanceof SSLSocket) {
+            ((SSLSocket)socket).setEnabledProtocols(SSLUtils.getSupportedProtocols(((SSLSocket)socket).getEnabledProtocols()));
+        }
         return socket;
     }
 
@@ -174,10 +176,16 @@ public class EasySSLProtocolSocketFactory implements SecureProtocolSocketFactory
         int timeout = params.getConnectionTimeout();
         SocketFactory socketfactory = getSSLContext().getSocketFactory();
         if (timeout == 0) {
-            return socketfactory.createSocket(host, port, localAddress, localPort);
+            Socket socket = socketfactory.createSocket(host, port, localAddress, localPort);
+            if (socket instanceof SSLSocket) {
+                ((SSLSocket)socket).setEnabledProtocols(SSLUtils.getSupportedProtocols(((SSLSocket)socket).getEnabledProtocols()));
+            }
+            return socket;
         } else {
-            SSLSocket socket = (SSLSocket)  socketfactory.createSocket();
-            socket.setEnabledProtocols(SSLUtils.getSupportedProtocols(socket.getEnabledProtocols()));
+            Socket socket = socketfactory.createSocket();
+            if (socket instanceof SSLSocket) {
+                ((SSLSocket)socket).setEnabledProtocols(SSLUtils.getSupportedProtocols(((SSLSocket)socket).getEnabledProtocols()));
+            }
             SocketAddress localaddr = new InetSocketAddress(localAddress, localPort);
             SocketAddress remoteaddr = new InetSocketAddress(host, port);
             socket.bind(localaddr);
@@ -187,14 +195,18 @@ public class EasySSLProtocolSocketFactory implements SecureProtocolSocketFactory
     }
 
     public Socket createSocket(String host, int port) throws IOException, UnknownHostException
{
-        SSLSocket socket = (SSLSocket) getSSLContext().getSocketFactory().createSocket(host,
port);
-        socket.setEnabledProtocols(SSLUtils.getSupportedProtocols(socket.getEnabledProtocols()));
+        Socket socket = (Socket) getSSLContext().getSocketFactory().createSocket(host, port);
+        if (socket instanceof SSLSocket) {
+            ((SSLSocket)socket).setEnabledProtocols(SSLUtils.getSupportedProtocols(((SSLSocket)socket).getEnabledProtocols()));
+        }
         return socket;
     }
 
     public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws
IOException, UnknownHostException {
-        SSLSocket s= (SSLSocket) getSSLContext().getSocketFactory().createSocket(socket,
host, port, autoClose);
-        s.setEnabledProtocols(SSLUtils.getSupportedProtocols(s.getEnabledProtocols()));
+        Socket s = getSSLContext().getSocketFactory().createSocket(socket, host, port, autoClose);
+        if (s instanceof SSLSocket) {
+            ((SSLSocket)s).setEnabledProtocols(SSLUtils.getSupportedProtocols(((SSLSocket)s).getEnabledProtocols()));
+        }
         return s;
     }
 


Mime
View raw message