| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_basic.h" | 5 #include "net/http/http_auth_handler_basic.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/i18n/icu_string_conversions.h" | 10 #include "base/i18n/icu_string_conversions.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 if (!base::ConvertToUtf8AndNormalize( | 45 if (!base::ConvertToUtf8AndNormalize( |
| 46 parameters.value(), base::kCodepageLatin1, realm)) | 46 parameters.value(), base::kCodepageLatin1, realm)) |
| 47 return false; | 47 return false; |
| 48 } | 48 } |
| 49 return parameters.valid(); | 49 return parameters.valid(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 bool HttpAuthHandlerBasic::Init(HttpAuth::ChallengeTokenizer* challenge) { | 54 bool HttpAuthHandlerBasic::Init(HttpAuth::ChallengeTokenizer* challenge) { |
| 55 auth_scheme_ = HttpAuth::AUTH_SCHEME_BASIC; | 55 auth_scheme_ = "basic"; |
| 56 score_ = 1; | 56 score_ = 1; |
| 57 properties_ = 0; | 57 properties_ = 0; |
| 58 return ParseChallenge(challenge); | 58 return ParseChallenge(challenge); |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool HttpAuthHandlerBasic::ParseChallenge( | 61 bool HttpAuthHandlerBasic::ParseChallenge( |
| 62 HttpAuth::ChallengeTokenizer* challenge) { | 62 HttpAuth::ChallengeTokenizer* challenge) { |
| 63 // Verify the challenge's auth-scheme. | 63 // Verify the challenge's auth-scheme. |
| 64 if (!LowerCaseEqualsASCII(challenge->scheme(), "basic")) | 64 if (!LowerCaseEqualsASCII(challenge->scheme(), "basic")) |
| 65 return false; | 65 return false; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // TODO(cbentzel): Move towards model of parsing in the factory | 119 // TODO(cbentzel): Move towards model of parsing in the factory |
| 120 // method and only constructing when valid. | 120 // method and only constructing when valid. |
| 121 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerBasic()); | 121 scoped_ptr<HttpAuthHandler> tmp_handler(new HttpAuthHandlerBasic()); |
| 122 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 122 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
| 123 return ERR_INVALID_RESPONSE; | 123 return ERR_INVALID_RESPONSE; |
| 124 handler->swap(tmp_handler); | 124 handler->swap(tmp_handler); |
| 125 return OK; | 125 return OK; |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace net | 128 } // namespace net |
| OLD | NEW |