| 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" | 9 #include "base/i18n/icu_string_conversions.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 DVLOG(1) << "Skipping unrecognized digest property"; | 263 DVLOG(1) << "Skipping unrecognized digest property"; |
| 264 // TODO(eroman): perhaps we should fail instead of silently skipping? | 264 // TODO(eroman): perhaps we should fail instead of silently skipping? |
| 265 } | 265 } |
| 266 return true; | 266 return true; |
| 267 } | 267 } |
| 268 | 268 |
| 269 // static | 269 // static |
| 270 std::string HttpAuthHandlerDigest::QopToString(QualityOfProtection qop) { | 270 std::string HttpAuthHandlerDigest::QopToString(QualityOfProtection qop) { |
| 271 switch (qop) { | 271 switch (qop) { |
| 272 case QOP_UNSPECIFIED: | 272 case QOP_UNSPECIFIED: |
| 273 return ""; | 273 return std::string(); |
| 274 case QOP_AUTH: | 274 case QOP_AUTH: |
| 275 return "auth"; | 275 return "auth"; |
| 276 default: | 276 default: |
| 277 NOTREACHED(); | 277 NOTREACHED(); |
| 278 return ""; | 278 return std::string(); |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| 282 // static | 282 // static |
| 283 std::string HttpAuthHandlerDigest::AlgorithmToString( | 283 std::string HttpAuthHandlerDigest::AlgorithmToString( |
| 284 DigestAlgorithm algorithm) { | 284 DigestAlgorithm algorithm) { |
| 285 switch (algorithm) { | 285 switch (algorithm) { |
| 286 case ALGORITHM_UNSPECIFIED: | 286 case ALGORITHM_UNSPECIFIED: |
| 287 return ""; | 287 return std::string(); |
| 288 case ALGORITHM_MD5: | 288 case ALGORITHM_MD5: |
| 289 return "MD5"; | 289 return "MD5"; |
| 290 case ALGORITHM_MD5_SESS: | 290 case ALGORITHM_MD5_SESS: |
| 291 return "MD5-sess"; | 291 return "MD5-sess"; |
| 292 default: | 292 default: |
| 293 NOTREACHED(); | 293 NOTREACHED(); |
| 294 return ""; | 294 return std::string(); |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 void HttpAuthHandlerDigest::GetRequestMethodAndPath( | 298 void HttpAuthHandlerDigest::GetRequestMethodAndPath( |
| 299 const HttpRequestInfo* request, | 299 const HttpRequestInfo* request, |
| 300 std::string* method, | 300 std::string* method, |
| 301 std::string* path) const { | 301 std::string* path) const { |
| 302 DCHECK(request); | 302 DCHECK(request); |
| 303 | 303 |
| 304 const GURL& url = request->url; | 304 const GURL& url = request->url; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // TODO(eroman): Supposedly IIS server requires quotes surrounding qop. | 372 // TODO(eroman): Supposedly IIS server requires quotes surrounding qop. |
| 373 authorization += ", qop=" + QopToString(qop_); | 373 authorization += ", qop=" + QopToString(qop_); |
| 374 authorization += ", nc=" + nc; | 374 authorization += ", nc=" + nc; |
| 375 authorization += ", cnonce=" + HttpUtil::Quote(cnonce); | 375 authorization += ", cnonce=" + HttpUtil::Quote(cnonce); |
| 376 } | 376 } |
| 377 | 377 |
| 378 return authorization; | 378 return authorization; |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace net | 381 } // namespace net |
| OLD | NEW |