cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1536288 - in /cxf/branches/2.7.x-fixes: ./ rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
Date Mon, 28 Oct 2013 09:07:51 GMT
Author: ningjiang
Date: Mon Oct 28 09:07:51 2013
New Revision: 1536288

URL: http://svn.apache.org/r1536288
Log:
Merged revisions 1535671 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1535671 | ningjiang | 2013-10-25 18:02:05 +0800 (Fri, 25 Oct 2013) | 1 line
  
  CXF-5333 Supported to set the TLSClientParameters dynamically
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
    cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1535671

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.7.x-fixes/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java?rev=1536288&r1=1536287&r2=1536288&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/transports/http-hc/src/main/java/org/apache/cxf/transport/http/asyncclient/AsyncHTTPConduit.java
Mon Oct 28 09:07:51 2013
@@ -446,10 +446,7 @@ public class AsyncHTTPConduit extends UR
                 entity.removeHeaders("Content-Type");
                 entity.setEntity(null);
             }
-            if (url.getScheme().equals("https") && tlsClientParameters == null) {
-                tlsClientParameters = new TLSClientParameters();
-            }
-            
+
             BasicHttpContext ctx = new BasicHttpContext();
             if (AsyncHTTPConduit.this.proxyAuthorizationPolicy != null
                 && AsyncHTTPConduit.this.proxyAuthorizationPolicy.getUserName() !=
null) {
@@ -473,7 +470,16 @@ public class AsyncHTTPConduit extends UR
             reg.register(new AsyncScheme("http", 80, null));
             if ("https".equals(url.getScheme())) {
                 try {
-                    final SSLContext sslcontext = getSSLContext();
+                    // check tlsClientParameters from message header
+                    TLSClientParameters tlsClientParameters = outMessage.get(TLSClientParameters.class);
+                    if (tlsClientParameters == null) {
+                        tlsClientParameters = getTlsClientParameters();
+                    }
+                    if (tlsClientParameters == null) {
+                        tlsClientParameters = new TLSClientParameters();
+                    }
+
+                    final SSLContext sslcontext = getSSLContext(tlsClientParameters);
                     reg.register(new AsyncScheme("https", 443, new SSLLayeringStrategy(sslcontext)
{
                         @Override
                         protected void initializeEngine(SSLEngine engine) {
@@ -797,11 +803,8 @@ public class AsyncHTTPConduit extends UR
     }
 
 
-    public synchronized SSLContext getSSLContext() throws GeneralSecurityException {
-        TLSClientParameters tlsClientParameters = getTlsClientParameters();
-        if (tlsClientParameters == null) {
-            tlsClientParameters = new TLSClientParameters();
-        }
+    public synchronized SSLContext getSSLContext(TLSClientParameters tlsClientParameters)
throws GeneralSecurityException {
+
         int hash = tlsClientParameters.hashCode();
         if (hash == lastTlsHash) {
             return sslContext;

Modified: cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java?rev=1536288&r1=1536287&r2=1536288&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/transports/http/src/main/java/org/apache/cxf/transport/http/URLConnectionHTTPConduit.java
Mon Oct 28 09:07:51 2013
@@ -32,6 +32,7 @@ import java.net.URLConnection;
 import java.util.logging.Level;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.configuration.jsse.TLSClientParameters;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.io.CacheAndWriteOutputStream;
 import org.apache.cxf.message.Message;
@@ -91,7 +92,12 @@ public class URLConnectionHTTPConduit ex
         URL url = uri.toURL();
         Proxy proxy = proxyFactory.createProxy(csPolicy , uri);
         message.put("http.scheme", uri.getScheme());
-        return connectionFactory.createConnection(tlsClientParameters, proxy, url);
+        // check tlsClientParameters from message header
+        TLSClientParameters clientParameters = message.get(TLSClientParameters.class);
+        if (clientParameters == null) {
+            clientParameters = tlsClientParameters;
+        }
+        return connectionFactory.createConnection(clientParameters, proxy, url);
     }
     protected void setupConnection(Message message, URI currentURL, HTTPClientPolicy csPolicy)
throws IOException {
         HttpURLConnection connection = createConnection(message, currentURL, csPolicy);



Mime
View raw message