You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by gg...@apache.org on 2017/05/05 21:17:59 UTC

svn commit: r1794107 - in /httpcomponents/httpcore/branches/4.4.x: ./ httpcore-ab/src/main/java/org/apache/http/benchmark/ httpcore/src/main/java/org/apache/http/ssl/ httpcore/src/test/java/org/apache/http/ssl/

Author: ggregory
Date: Fri May  5 21:17:59 2017
New Revision: 1794107

URL: http://svn.apache.org/viewvc?rev=1794107&view=rev
Log:
HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String). Local build OK.

Modified:
    httpcomponents/httpcore/branches/4.4.x/RELEASE_NOTES.txt
    httpcomponents/httpcore/branches/4.4.x/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
    httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
    httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java

Modified: httpcomponents/httpcore/branches/4.4.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/RELEASE_NOTES.txt?rev=1794107&r1=1794106&r2=1794107&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/branches/4.4.x/RELEASE_NOTES.txt Fri May  5 21:17:59 2017
@@ -15,6 +15,9 @@ Changelog
 * HTTPCORE-461: Add factory methods to DefaultHttpServerIODispatch to handle a null SSLContext.
   Contributed by Gary Gregory <ggregory at apache.org>
 
+* HTTPCORE-462: Deprecate SSLContextBuilder.useProtocol(String) in favor a new method setProtocol(String).
+  Contributed by Gary Gregory <ggregory at apache.org>
+
 
 Release 4.4.6
 -------------------

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java?rev=1794107&r1=1794106&r2=1794107&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java (original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-ab/src/main/java/org/apache/http/benchmark/HttpBenchmark.java Fri May  5 21:17:59 2017
@@ -184,7 +184,7 @@ public class HttpBenchmark {
         SocketFactory socketFactory = null;
         if ("https".equals(host.getSchemeName())) {
             final SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
-            sslContextBuilder.useProtocol("SSL");
+            sslContextBuilder.setProtocol("SSL");
             if (config.isDisableSSLVerification()) {
                 sslContextBuilder.loadTrustMaterial(null, new TrustStrategy() {
 

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java?rev=1794107&r1=1794106&r2=1794107&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java (original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore/src/main/java/org/apache/http/ssl/SSLContextBuilder.java Fri May  5 21:17:59 2017
@@ -107,11 +107,33 @@ public class SSLContextBuilder {
      * @see <a href=
      *      "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
      *      Cryptography Architecture Standard Algorithm Name Documentation</a>
+     * @deprecated Use {@link #setProtocol(String)}.
      */
+    @Deprecated
     public SSLContextBuilder useProtocol(final String protocol) {
         this.protocol = protocol;
         return this;
     }
+
+    /**
+     * Sets the SSLContext algorithm name.
+     *
+     * @param protocol
+     *            the SSLContext algorithm name of the requested protocol. See
+     *            the SSLContext section in the <a href=
+     *            "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *            Cryptography Architecture Standard Algorithm Name
+     *            Documentation</a> for more information.
+     * @return this builder
+     * @see <a href=
+     *      "https://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SSLContext">Java
+     *      Cryptography Architecture Standard Algorithm Name Documentation</a>
+     * @since 4.4.7
+     */
+    public SSLContextBuilder setProtocol(final String protocol) {
+        this.protocol = protocol;
+        return this;
+    }
 
     public SSLContextBuilder setSecureRandom(final SecureRandom secureRandom) {
         this.secureRandom = secureRandom;

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java?rev=1794107&r1=1794106&r2=1794107&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java (original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore/src/test/java/org/apache/http/ssl/TestSSLContextBuilder.java Fri May  5 21:17:59 2017
@@ -90,6 +90,18 @@ public class TestSSLContextBuilder {
     @Test
     public void testBuildAllNull() throws Exception {
         final SSLContext sslContext = SSLContextBuilder.create()
+                .setProtocol(null)
+                .setSecureRandom(null)
+                .loadTrustMaterial((KeyStore) null, null)
+                .loadKeyMaterial((KeyStore) null, null, null)
+                .build();
+        Assert.assertNotNull(sslContext);
+        Assert.assertEquals("TLS", sslContext.getProtocol());
+    }
+
+    @Test
+    public void testBuildAllNull_deprecated() throws Exception {
+        final SSLContext sslContext = SSLContextBuilder.create()
                 .useProtocol(null)
                 .setSecureRandom(null)
                 .loadTrustMaterial((KeyStore) null, null)