It is legal for AuthScheme to be null

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1294348 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2012-02-27 21:44:50 +00:00
parent 647e4dc314
commit 3d2b0023fe
2 changed files with 2 additions and 6 deletions

View File

@ -245,17 +245,13 @@ class AuthenticationStrategyImpl implements AuthenticationStrategy {
if (authhost == null) { if (authhost == null) {
throw new IllegalArgumentException("Host may not be null"); throw new IllegalArgumentException("Host may not be null");
} }
if (authScheme == null) {
throw new IllegalArgumentException("Auth scheme may not be null");
}
if (context == null) { if (context == null) {
throw new IllegalArgumentException("HTTP context may not be null"); throw new IllegalArgumentException("HTTP context may not be null");
} }
AuthCache authCache = (AuthCache) context.getAttribute(ClientContext.AUTH_CACHE); AuthCache authCache = (AuthCache) context.getAttribute(ClientContext.AUTH_CACHE);
if (authCache != null) { if (authCache != null) {
if (this.log.isDebugEnabled()) { if (this.log.isDebugEnabled()) {
this.log.debug("Removing from cache '" + authScheme.getSchemeName() + this.log.debug("Clearing cached auth scheme for " + authhost);
"' auth scheme for " + authhost);
} }
authCache.remove(authhost); authCache.remove(authhost);
} }

View File

@ -108,7 +108,7 @@ public class HttpAuthenticator {
case HANDSHAKE: case HANDSHAKE:
if (authScheme == null) { if (authScheme == null) {
this.log.debug("Auth scheme is null"); this.log.debug("Auth scheme is null");
authStrategy.authFailed(host, authState.getAuthScheme(), context); authStrategy.authFailed(host, null, context);
authState.reset(); authState.reset();
authState.setState(AuthProtocolState.FAILURE); authState.setState(AuthProtocolState.FAILURE);
return false; return false;