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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 85 } |
86 | 86 |
87 void HttpAuthHandlerDigest::Factory::set_nonce_generator( | 87 void HttpAuthHandlerDigest::Factory::set_nonce_generator( |
88 const NonceGenerator* nonce_generator) { | 88 const NonceGenerator* nonce_generator) { |
89 nonce_generator_.reset(nonce_generator); | 89 nonce_generator_.reset(nonce_generator); |
90 } | 90 } |
91 | 91 |
92 int HttpAuthHandlerDigest::Factory::CreateAuthHandler( | 92 int HttpAuthHandlerDigest::Factory::CreateAuthHandler( |
93 HttpAuthChallengeTokenizer* challenge, | 93 HttpAuthChallengeTokenizer* challenge, |
94 HttpAuth::Target target, | 94 HttpAuth::Target target, |
95 const GURL& origin, | 95 const url::Origin& origin, |
96 CreateReason reason, | 96 CreateReason reason, |
97 int digest_nonce_count, | 97 int digest_nonce_count, |
98 const BoundNetLog& net_log, | 98 const BoundNetLog& net_log, |
99 scoped_ptr<HttpAuthHandler>* handler) { | 99 scoped_ptr<HttpAuthHandler>* handler) { |
100 // TODO(cbentzel): Move towards model of parsing in the factory | 100 // TODO(cbentzel): Move towards model of parsing in the factory |
101 // method and only constructing when valid. | 101 // method and only constructing when valid. |
102 scoped_ptr<HttpAuthHandler> tmp_handler( | 102 scoped_ptr<HttpAuthHandler> tmp_handler( |
103 new HttpAuthHandlerDigest(digest_nonce_count, nonce_generator_.get())); | 103 new HttpAuthHandlerDigest(digest_nonce_count, nonce_generator_.get())); |
104 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) | 104 if (!tmp_handler->InitFromChallenge(challenge, target, origin, net_log)) |
105 return ERR_INVALID_RESPONSE; | 105 return ERR_INVALID_RESPONSE; |
(...skipping 268 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 |