HTTPCLIENT-1888: Regression in SystemDefaultCredentialsProvider#getCredentials causing NPE

This commit is contained in:
Oleg Kalnichevski 2017-12-05 09:57:34 +01:00
parent ea73f439e9
commit 5bed670873
2 changed files with 2 additions and 3 deletions

View File

@ -190,8 +190,7 @@ abstract class AuthenticationStrategyImpl implements AuthenticationStrategy {
authScheme.processChallenge(challenge);
final AuthScope authScope = new AuthScope(
authhost.getHostName(),
authhost.getPort(),
authhost,
authScheme.getRealm(),
authScheme.getSchemeName());

View File

@ -111,7 +111,7 @@ public class SystemDefaultCredentialsProvider implements CredentialsProvider {
final String host = authscope.getHost();
if (host != null) {
final HttpHost origin = authscope.getOrigin();
final String protocol = origin != null ? origin.getSchemeName() : (origin.getPort() == 443 ? "https" : "http");
final String protocol = origin != null ? origin.getSchemeName() : (authscope.getPort() == 443 ? "https" : "http");
PasswordAuthentication systemcreds = getSystemCreds(protocol, authscope, Authenticator.RequestorType.SERVER);
if (systemcreds == null) {
systemcreds = getSystemCreds(protocol, authscope, Authenticator.RequestorType.PROXY);