fapifta commented on code in PR #10111:
URL: https://github.com/apache/ozone/pull/10111#discussion_r3131356669


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/http/HttpServer2.java:
##########
@@ -565,17 +573,59 @@ private ServerConnector createHttpsChannelConnector(
           sslContextFactory.setTrustStorePassword(trustStorePassword);
         }
       }
-      if (null != excludeCiphers && !excludeCiphers.isEmpty()) {
+      if (excludeCiphers != null && !excludeCiphers.isEmpty()) {
         sslContextFactory.setExcludeCipherSuites(
             StringUtils.getTrimmedStrings(excludeCiphers));
         LOG.info("Excluded Cipher List: {}", excludeCiphers);
       }
 
+      if (includeCiphers != null && !includeCiphers.isEmpty()) {
+        sslContextFactory.setIncludeCipherSuites(
+            StringUtils.getTrimmedStrings(includeCiphers));
+        LOG.info("Included Cipher List: {}", includeCiphers);
+      }
+
+      setEnabledProtocols(sslContextFactory);
+
       conn.addFirstConnectionFactory(new 
SslConnectionFactory(sslContextFactory,
           HttpVersion.HTTP_1_1.asString()));
 
       return conn;
     }
+
+    private void setEnabledProtocols(
+        SslContextFactory sslContextFactory) {
+      String enabledProtocols = conf.get(
+          SSLFactory.SSL_ENABLED_PROTOCOLS_KEY,
+          SSLFactory.SSL_ENABLED_PROTOCOLS_DEFAULT);
+      if (!enabledProtocols.equals(
+          SSLFactory.SSL_ENABLED_PROTOCOLS_DEFAULT)) {
+        String[] jettyExcludedProtocols =
+            sslContextFactory.getExcludeProtocols();
+        String[] enabledProtocolsArray =
+            StringUtils.getTrimmedStrings(enabledProtocols);
+        List<String> enabledProtocolsList =
+            Arrays.asList(enabledProtocolsArray);
+
+        List<String> resetExcludedProtocols = new ArrayList<>();
+        for (String jettyExcludedProtocol : jettyExcludedProtocols) {
+          if (!enabledProtocolsList.contains(jettyExcludedProtocol)) {
+            resetExcludedProtocols.add(jettyExcludedProtocol);
+          } else {
+            LOG.debug("Removed {} from exclude protocol list",
+                jettyExcludedProtocol);
+          }
+        }
+
+        sslContextFactory.setExcludeProtocols(
+            resetExcludedProtocols.toArray(new String[0]));
+        LOG.info("Reset exclude protocol list: {}",
+            resetExcludedProtocols);

Review Comment:
   reformatted the code, and also rewritten the method based on the below 
suggestion to use removall



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to