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); authScheme.processChallenge(challenge);
final AuthScope authScope = new AuthScope( final AuthScope authScope = new AuthScope(
authhost.getHostName(), authhost,
authhost.getPort(),
authScheme.getRealm(), authScheme.getRealm(),
authScheme.getSchemeName()); authScheme.getSchemeName());

View File

@ -111,7 +111,7 @@ public class SystemDefaultCredentialsProvider implements CredentialsProvider {
final String host = authscope.getHost(); final String host = authscope.getHost();
if (host != null) { if (host != null) {
final HttpHost origin = authscope.getOrigin(); 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); PasswordAuthentication systemcreds = getSystemCreds(protocol, authscope, Authenticator.RequestorType.SERVER);
if (systemcreds == null) { if (systemcreds == null) {
systemcreds = getSystemCreds(protocol, authscope, Authenticator.RequestorType.PROXY); systemcreds = getSystemCreds(protocol, authscope, Authenticator.RequestorType.PROXY);