hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1567926 - /httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
Date Thu, 13 Feb 2014 13:58:42 GMT
Author: olegk
Date: Thu Feb 13 13:58:41 2014
New Revision: 1567926

URL: http://svn.apache.org/r1567926
Log:
HTTPCLIENT-1458: SystemDefaultCredentialsProvider always uses 'http' as an authentication
protocol to Authenticator#requestPasswordAuthentication call

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

Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java?rev=1567926&r1=1567925&r2=1567926&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
Thu Feb 13 13:58:41 2014
@@ -32,6 +32,7 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import org.apache.http.HttpHost;
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.Credentials;
@@ -87,11 +88,16 @@ public class SystemDefaultCredentialsPro
     private static PasswordAuthentication getSystemCreds(
             final AuthScope authscope,
             final Authenticator.RequestorType requestorType) {
+        final String hostname = authscope.getHost();
+        final int port = authscope.getPort();
+        final HttpHost origin = authscope.getOrigin();
+        final String protocol = origin != null ? origin.getSchemeName() :
+                (port == 443 ? "https" : "http");
         return Authenticator.requestPasswordAuthentication(
-                authscope.getHost(),
+                hostname,
                 null,
-                authscope.getPort(),
-                "http",
+                port,
+                protocol,
                 null,
                 translateScheme(authscope.getScheme()),
                 null,



Mime
View raw message