You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by wu...@apache.org on 2022/11/22 16:11:22 UTC

[ambari] branch trunk updated: AMBARI-25411: Cannot use HTTPS repourl and VDF url (#3564)

This is an automated email from the ASF dual-hosted git repository.

wuzhiguo pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 4da2e3112f AMBARI-25411: Cannot use HTTPS repourl and VDF url (#3564)
4da2e3112f is described below

commit 4da2e3112f41e0dcc40d0e9a7ff9ac9c1959d7e5
Author: Yu Hou <52...@qq.com>
AuthorDate: Wed Nov 23 00:10:55 2022 +0800

    AMBARI-25411: Cannot use HTTPS repourl and VDF url (#3564)
---
 .../ambari/server/controller/internal/URLStreamProvider.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
index 1a5d55e01c..a2923b15d4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/URLStreamProvider.java
@@ -195,7 +195,7 @@ public class URLStreamProvider implements StreamProvider {
 
     URL url = new URL(spec);
     HttpURLConnection connection = (spec.startsWith("https") && setupTruststoreForHttps) ?
-            getSSLConnection(spec) : getConnection(url);
+            getSSLConnection(url) : getConnection(url);
 
     AppCookieManager appCookieManager = getAppCookieManager();
 
@@ -245,7 +245,7 @@ public class URLStreamProvider implements StreamProvider {
       }
       if (wwwAuthHeader != null &&
         wwwAuthHeader.trim().startsWith(NEGOTIATE)) {
-        connection = spec.startsWith("https") ? getSSLConnection(spec) : getConnection(url);
+        connection = spec.startsWith("https") ? getSSLConnection(url) : getConnection(url);
         appCookie = appCookieManager.getAppCookie(spec, true);
         connection.setRequestProperty(COOKIE, appCookie);
         connection.setConnectTimeout(connTimeout);
@@ -344,7 +344,7 @@ public class URLStreamProvider implements StreamProvider {
   }
 
   // Get an ssl connection
-  protected HttpsURLConnection getSSLConnection(String spec) throws IOException, IllegalStateException {
+  protected HttpsURLConnection getSSLConnection(URL url) throws IOException, IllegalStateException {
 
     if (sslSocketFactory == null) {
       synchronized (this) {
@@ -353,7 +353,7 @@ public class URLStreamProvider implements StreamProvider {
           if (trustStorePath == null || trustStorePassword == null) {
             String msg =
                     String.format("Can't get secure connection to %s.  Truststore path or password is not set.",
-                            URLCredentialsHider.hideCredentials(spec));
+                            URLCredentialsHider.hideCredentials(url.toString()));
 
             LOG.error(msg);
             throw new IllegalStateException(msg);
@@ -380,7 +380,7 @@ public class URLStreamProvider implements StreamProvider {
         }
       }
     }
-    HttpsURLConnection connection = (HttpsURLConnection) (new URL(spec)
+    HttpsURLConnection connection = (HttpsURLConnection) (url
         .openConnection());
 
     connection.setSSLSocketFactory(sslSocketFactory);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ambari.apache.org
For additional commands, e-mail: commits-help@ambari.apache.org