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_digest.h" | 5 #include "net/http/http_auth_handler_digest.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/i18n/icu_string_conversions.h" | |
10 #include "base/logging.h" | 9 #include "base/logging.h" |
11 #include "base/md5.h" | 10 #include "base/md5.h" |
12 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
13 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
14 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
16 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "net/base/net_string_util.h" |
17 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
18 #include "net/http/http_auth.h" | 18 #include "net/http/http_auth.h" |
19 #include "net/http/http_auth_challenge_tokenizer.h" | 19 #include "net/http/http_auth_challenge_tokenizer.h" |
20 #include "net/http/http_request_info.h" | 20 #include "net/http/http_request_info.h" |
21 #include "net/http/http_util.h" | 21 #include "net/http/http_util.h" |
22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 // Digest authentication is specified in RFC 2617. | 26 // Digest authentication is specified in RFC 2617. |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 if (nonce_.empty()) | 220 if (nonce_.empty()) |
221 return false; | 221 return false; |
222 | 222 |
223 return true; | 223 return true; |
224 } | 224 } |
225 | 225 |
226 bool HttpAuthHandlerDigest::ParseChallengeProperty(const std::string& name, | 226 bool HttpAuthHandlerDigest::ParseChallengeProperty(const std::string& name, |
227 const std::string& value) { | 227 const std::string& value) { |
228 if (LowerCaseEqualsASCII(name, "realm")) { | 228 if (LowerCaseEqualsASCII(name, "realm")) { |
229 std::string realm; | 229 std::string realm; |
230 if (!base::ConvertToUtf8AndNormalize(value, base::kCodepageLatin1, &realm)) | 230 if (!net::ConvertLatin1ToUtf8AndNormalize(value, &realm)) |
231 return false; | 231 return false; |
232 realm_ = realm; | 232 realm_ = realm; |
233 original_realm_ = value; | 233 original_realm_ = value; |
234 } else if (LowerCaseEqualsASCII(name, "nonce")) { | 234 } else if (LowerCaseEqualsASCII(name, "nonce")) { |
235 nonce_ = value; | 235 nonce_ = value; |
236 } else if (LowerCaseEqualsASCII(name, "domain")) { | 236 } else if (LowerCaseEqualsASCII(name, "domain")) { |
237 domain_ = value; | 237 domain_ = value; |
238 } else if (LowerCaseEqualsASCII(name, "opaque")) { | 238 } else if (LowerCaseEqualsASCII(name, "opaque")) { |
239 opaque_ = value; | 239 opaque_ = value; |
240 } else if (LowerCaseEqualsASCII(name, "stale")) { | 240 } else if (LowerCaseEqualsASCII(name, "stale")) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 // TODO(eroman): Supposedly IIS server requires quotes surrounding qop. | 374 // TODO(eroman): Supposedly IIS server requires quotes surrounding qop. |
375 authorization += ", qop=" + QopToString(qop_); | 375 authorization += ", qop=" + QopToString(qop_); |
376 authorization += ", nc=" + nc; | 376 authorization += ", nc=" + nc; |
377 authorization += ", cnonce=" + HttpUtil::Quote(cnonce); | 377 authorization += ", cnonce=" + HttpUtil::Quote(cnonce); |
378 } | 378 } |
379 | 379 |
380 return authorization; | 380 return authorization; |
381 } | 381 } |
382 | 382 |
383 } // namespace net | 383 } // namespace net |
OLD | NEW |