HTTPCLIENT-1107: support auth scheme switching

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1175378 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2011-09-25 12:38:43 +00:00
parent c4d1599bd0
commit 3853906d7d
2 changed files with 7 additions and 5 deletions

View File

@ -102,7 +102,7 @@ public abstract class AbstractAuthenticationHandler implements AuthenticationHan
}
int endIndex = pos;
String s = buffer.substring(beginIndex, endIndex);
map.put(s.toLowerCase(Locale.ENGLISH), header);
map.put(s.toLowerCase(Locale.US), header);
}
return map;
}

View File

@ -79,10 +79,12 @@ public class HttpAuthenticator {
String id = authScheme.getSchemeName();
Header challenge = challenges.get(id.toLowerCase(Locale.US));
if (challenge == null) {
if (this.log.isWarnEnabled()) {
this.log.warn(id + " authorization challenge expected, but not found");
}
return false;
// Retry authentication with a different scheme
authState.invalidate();
authScheme = authHandler.selectScheme(challenges, response, context);
authState.setAuthScheme(authScheme);
id = authScheme.getSchemeName();
challenge = challenges.get(id.toLowerCase(Locale.US));
}
authScheme.processChallenge(challenge);
this.log.debug("Authorization challenge processed");