Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(978)

Unified Diff: net/http/http_auth_handler_basic.cc

Issue 6525035: Invalidate credentials if the server rejects them. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extra whitespace Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/http/http_auth_handler_basic.cc
diff --git a/net/http/http_auth_handler_basic.cc b/net/http/http_auth_handler_basic.cc
index e48aa6761ebfc40c886513169e0f2c4b92429971..9ed28e2063297c119a647595e0086d9643e0af45 100644
--- a/net/http/http_auth_handler_basic.cc
+++ b/net/http/http_auth_handler_basic.cc
@@ -53,9 +53,20 @@ bool HttpAuthHandlerBasic::ParseChallenge(
HttpAuth::AuthorizationResult HttpAuthHandlerBasic::HandleAnotherChallenge(
HttpAuth::ChallengeTokenizer* challenge) {
- // Basic authentication is always a single round, so any responses should
- // be treated as a rejection.
- return HttpAuth::AUTHORIZATION_RESULT_REJECT;
+ // Basic authentication is always a single round, so any responses
+ // should be treated as a rejection. However, if the new challenge
+ // is for a different realm, then indicate the realm change.
+ HttpUtil::NameValuePairsIterator parameters = challenge->param_pairs();
+ std::string realm;
+ while (parameters.GetNext()) {
+ if (LowerCaseEqualsASCII(parameters.name(), "realm")) {
+ realm = parameters.value();
+ break;
+ }
+ }
+ return (realm_ != realm)?
+ HttpAuth::AUTHORIZATION_RESULT_DIFFERENT_REALM:
+ HttpAuth::AUTHORIZATION_RESULT_REJECT;
}
int HttpAuthHandlerBasic::GenerateAuthTokenImpl(

Powered by Google App Engine
This is Rietveld 408576698