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

Unified Diff: net/http/http_auth_handler_mock.cc

Issue 7748033: Don't try to use explicit credentials with schemes that don't support it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unit test Created 9 years, 4 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
« no previous file with comments | « net/http/http_auth_handler_mock.h ('k') | net/http/http_auth_handler_negotiate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_auth_handler_mock.cc
diff --git a/net/http/http_auth_handler_mock.cc b/net/http/http_auth_handler_mock.cc
index 9887937fef91017a2591c62131f1ce14cf0429f7..9331ae73da136e6dc690d89fc048a294988003ee 100644
--- a/net/http/http_auth_handler_mock.cc
+++ b/net/http/http_auth_handler_mock.cc
@@ -18,7 +18,9 @@ HttpAuthHandlerMock::HttpAuthHandlerMock()
generate_async_(false), generate_rv_(OK),
auth_token_(NULL),
first_round_(true),
- connection_based_(false) {
+ connection_based_(false),
+ allows_default_credentials_(false),
+ allows_explicit_credentials_(true) {
}
HttpAuthHandlerMock::~HttpAuthHandlerMock() {
@@ -73,7 +75,9 @@ void HttpAuthHandlerMock::SetGenerateExpectation(bool async, int rv) {
HttpAuth::AuthorizationResult HttpAuthHandlerMock::HandleAnotherChallenge(
HttpAuth::ChallengeTokenizer* challenge) {
- if (!is_connection_based())
+ // If we receive an empty challenge for a connection based scheme, or a second
+ // challenge for a non connection based scheme, assume it's a rejection.
+ if (!is_connection_based() || challenge->base64_param().empty())
return HttpAuth::AUTHORIZATION_RESULT_REJECT;
if (!LowerCaseEqualsASCII(challenge->scheme(), "mock"))
return HttpAuth::AUTHORIZATION_RESULT_INVALID;
@@ -84,6 +88,14 @@ bool HttpAuthHandlerMock::NeedsIdentity() {
return first_round_;
}
+bool HttpAuthHandlerMock::AllowsDefaultCredentials() {
+ return allows_default_credentials_;
+}
+
+bool HttpAuthHandlerMock::AllowsExplicitCredentials() {
+ return allows_explicit_credentials_;
+}
+
bool HttpAuthHandlerMock::Init(HttpAuth::ChallengeTokenizer* challenge) {
auth_scheme_ = HttpAuth::AUTH_SCHEME_MOCK;
score_ = 1;
« no previous file with comments | « net/http/http_auth_handler_mock.h ('k') | net/http/http_auth_handler_negotiate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698