OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/http_auth_handler_digest.h" | 5 #include "net/http/http_auth_handler_digest.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/md5.h" | 10 #include "base/md5.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // | 259 // |
260 // Note that according to RFC 2617 (section 1.2) the realm is required. | 260 // Note that according to RFC 2617 (section 1.2) the realm is required. |
261 // However we allow it to be omitted, in which case it will default to the | 261 // However we allow it to be omitted, in which case it will default to the |
262 // empty string. | 262 // empty string. |
263 // | 263 // |
264 // This allowance is for better compatibility with webservers that fail to | 264 // This allowance is for better compatibility with webservers that fail to |
265 // send the realm (See http://crbug.com/20984 for an instance where a | 265 // send the realm (See http://crbug.com/20984 for an instance where a |
266 // webserver was not sending the realm with a BASIC challenge). | 266 // webserver was not sending the realm with a BASIC challenge). |
267 bool HttpAuthHandlerDigest::ParseChallenge( | 267 bool HttpAuthHandlerDigest::ParseChallenge( |
268 HttpAuth::ChallengeTokenizer* challenge) { | 268 HttpAuth::ChallengeTokenizer* challenge) { |
269 auth_scheme_ = AUTH_SCHEME_DIGEST; | 269 auth_scheme_ = HttpAuth::AUTH_SCHEME_DIGEST; |
270 scheme_ = "digest"; | |
271 score_ = 2; | 270 score_ = 2; |
272 properties_ = ENCRYPTS_IDENTITY; | 271 properties_ = ENCRYPTS_IDENTITY; |
273 | 272 |
274 // Initialize to defaults. | 273 // Initialize to defaults. |
275 stale_ = false; | 274 stale_ = false; |
276 algorithm_ = ALGORITHM_UNSPECIFIED; | 275 algorithm_ = ALGORITHM_UNSPECIFIED; |
277 qop_ = QOP_UNSPECIFIED; | 276 qop_ = QOP_UNSPECIFIED; |
278 realm_ = nonce_ = domain_ = opaque_ = std::string(); | 277 realm_ = nonce_ = domain_ = opaque_ = std::string(); |
279 | 278 |
280 // FAIL -- Couldn't match auth-scheme. | 279 // FAIL -- Couldn't match auth-scheme. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 // method and only constructing when valid. | 366 // method and only constructing when valid. |
368 scoped_ptr<HttpAuthHandler> tmp_handler( | 367 scoped_ptr<HttpAuthHandler> tmp_handler( |
369 new HttpAuthHandlerDigest(digest_nonce_count, nonce_generator_.get())); | 368 new HttpAuthHandlerDigest(digest_nonce_count, nonce_generator_.get())); |
370 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 369 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
371 return ERR_INVALID_RESPONSE; | 370 return ERR_INVALID_RESPONSE; |
372 handler->swap(tmp_handler); | 371 handler->swap(tmp_handler); |
373 return OK; | 372 return OK; |
374 } | 373 } |
375 | 374 |
376 } // namespace net | 375 } // namespace net |
OLD | NEW |