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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/md5.h" | 10 #include "base/md5.h" |
(...skipping 209 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 (!net::ConvertLatin1ToUtf8AndNormalize(value, &realm)) | 230 if (!net::ConvertToUtf8AndNormalize(value, kCharsetLatin1, &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 |