hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1460555 - /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java
Date Mon, 25 Mar 2013 09:15:28 GMT
Author: olegk
Date: Mon Mar 25 09:15:28 2013
New Revision: 1460555

URL: http://svn.apache.org/r1460555
Log:
Added SSLContext as an option for SSL customization

Modified:
    httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java?rev=1460555&r1=1460554&r2=1460555&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java
Mon Mar 25 09:15:28 2013
@@ -34,6 +34,8 @@ import java.util.Collection;
 import java.util.LinkedList;
 import java.util.List;
 
+import javax.net.ssl.SSLContext;
+
 import org.apache.http.ConnectionReuseStrategy;
 import org.apache.http.Header;
 import org.apache.http.HttpHost;
@@ -141,6 +143,7 @@ public class HttpClientBuilder {
 
     private HttpRequestExecutor requestExec;
     private LayeredConnectionSocketFactory sslSocketFactory;
+    private SSLContext sslcontext;
     private HttpClientConnectionManager connManager;
     private SchemePortResolver schemePortResolver;
     private ConnectionReuseStrategy reuseStrategy;
@@ -443,10 +446,14 @@ public class HttpClientBuilder {
         if (connManager == null) {
             LayeredConnectionSocketFactory sslSocketFactory = this.sslSocketFactory;
             if (sslSocketFactory == null) {
-                if (systemProperties) {
-                    sslSocketFactory = SSLSocketFactory.getSystemSocketFactory();
+                if (sslcontext != null) {
+                    sslSocketFactory = new SSLSocketFactory(sslcontext);
                 } else {
-                    sslSocketFactory = SSLSocketFactory.getSocketFactory();
+                    if (systemProperties) {
+                        sslSocketFactory = SSLSocketFactory.getSystemSocketFactory();
+                    } else {
+                        sslSocketFactory = SSLSocketFactory.getSocketFactory();
+                    }
                 }
             }
             final PoolingHttpClientConnectionManager poolingmgr = new PoolingHttpClientConnectionManager(



Mime
View raw message