hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [1/6] httpcomponents-client git commit: Treat System#getProperty as a privileged action
Date Mon, 13 Nov 2017 21:45:56 GMT
Repository: httpcomponents-client
Updated Branches:
  refs/heads/master 3db122824 -> 6228a7361


Treat System#getProperty as a privileged action


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/commit/703b7968
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/tree/703b7968
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-client/diff/703b7968

Branch: refs/heads/master
Commit: 703b7968c511905ca631a7d8e01a0798a18217e6
Parents: 3db1228
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Mon Nov 13 10:46:09 2017 +0100
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Mon Nov 13 10:46:09 2017 +0100

----------------------------------------------------------------------
 .../org/apache/hc/client5/http/ssl/H2TlsStrategy.java | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-client/blob/703b7968/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/H2TlsStrategy.java
----------------------------------------------------------------------
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/H2TlsStrategy.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/H2TlsStrategy.java
index 79150c4..df82ba4 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/H2TlsStrategy.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/H2TlsStrategy.java
@@ -28,6 +28,8 @@
 package org.apache.hc.client5.http.ssl;
 
 import java.net.SocketAddress;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
@@ -73,6 +75,14 @@ public class H2TlsStrategy implements TlsStrategy {
         return s.split(" *, *");
     }
 
+    private static String getProperty(final String key) {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+            @Override
+            public String run() {
+                return System.getProperty(key);
+            }
+        });
+    }
     public static HostnameVerifier getDefaultHostnameVerifier() {
         return new DefaultHostnameVerifier(PublicSuffixMatcherLoader.getDefault());
     }
@@ -86,8 +96,8 @@ public class H2TlsStrategy implements TlsStrategy {
     public static TlsStrategy getSystemDefault() {
         return new H2TlsStrategy(
                 SSLContexts.createSystemDefault(),
-                split(System.getProperty("https.protocols")),
-                split(System.getProperty("https.cipherSuites")),
+                split(getProperty("https.protocols")),
+                split(getProperty("https.cipherSuites")),
                 SSLBufferManagement.STATIC,
                 getDefaultHostnameVerifier());
     }


Mime
View raw message