OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_factory.h" | 5 #include "net/http/http_auth_handler_factory.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "net/http/http_auth_handler_negotiate.h" | 21 #include "net/http/http_auth_handler_negotiate.h" |
22 #endif | 22 #endif |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 int HttpAuthHandlerFactory::CreateAuthHandlerFromString( | 26 int HttpAuthHandlerFactory::CreateAuthHandlerFromString( |
27 const std::string& challenge, | 27 const std::string& challenge, |
28 HttpAuth::Target target, | 28 HttpAuth::Target target, |
29 const SSLInfo& ssl_info, | 29 const SSLInfo& ssl_info, |
30 const GURL& origin, | 30 const GURL& origin, |
31 const BoundNetLog& net_log, | 31 const NetLogWithSource& net_log, |
32 std::unique_ptr<HttpAuthHandler>* handler) { | 32 std::unique_ptr<HttpAuthHandler>* handler) { |
33 HttpAuthChallengeTokenizer props(challenge.begin(), challenge.end()); | 33 HttpAuthChallengeTokenizer props(challenge.begin(), challenge.end()); |
34 return CreateAuthHandler(&props, target, ssl_info, origin, CREATE_CHALLENGE, | 34 return CreateAuthHandler(&props, target, ssl_info, origin, CREATE_CHALLENGE, |
35 1, net_log, handler); | 35 1, net_log, handler); |
36 } | 36 } |
37 | 37 |
38 int HttpAuthHandlerFactory::CreatePreemptiveAuthHandlerFromString( | 38 int HttpAuthHandlerFactory::CreatePreemptiveAuthHandlerFromString( |
39 const std::string& challenge, | 39 const std::string& challenge, |
40 HttpAuth::Target target, | 40 HttpAuth::Target target, |
41 const GURL& origin, | 41 const GURL& origin, |
42 int digest_nonce_count, | 42 int digest_nonce_count, |
43 const BoundNetLog& net_log, | 43 const NetLogWithSource& net_log, |
44 std::unique_ptr<HttpAuthHandler>* handler) { | 44 std::unique_ptr<HttpAuthHandler>* handler) { |
45 HttpAuthChallengeTokenizer props(challenge.begin(), challenge.end()); | 45 HttpAuthChallengeTokenizer props(challenge.begin(), challenge.end()); |
46 SSLInfo null_ssl_info; | 46 SSLInfo null_ssl_info; |
47 return CreateAuthHandler(&props, target, null_ssl_info, origin, | 47 return CreateAuthHandler(&props, target, null_ssl_info, origin, |
48 CREATE_PREEMPTIVE, digest_nonce_count, net_log, | 48 CREATE_PREEMPTIVE, digest_nonce_count, net_log, |
49 handler); | 49 handler); |
50 } | 50 } |
51 | 51 |
52 namespace { | 52 namespace { |
53 | 53 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 return registry_factory; | 163 return registry_factory; |
164 } | 164 } |
165 | 165 |
166 int HttpAuthHandlerRegistryFactory::CreateAuthHandler( | 166 int HttpAuthHandlerRegistryFactory::CreateAuthHandler( |
167 HttpAuthChallengeTokenizer* challenge, | 167 HttpAuthChallengeTokenizer* challenge, |
168 HttpAuth::Target target, | 168 HttpAuth::Target target, |
169 const SSLInfo& ssl_info, | 169 const SSLInfo& ssl_info, |
170 const GURL& origin, | 170 const GURL& origin, |
171 CreateReason reason, | 171 CreateReason reason, |
172 int digest_nonce_count, | 172 int digest_nonce_count, |
173 const BoundNetLog& net_log, | 173 const NetLogWithSource& net_log, |
174 std::unique_ptr<HttpAuthHandler>* handler) { | 174 std::unique_ptr<HttpAuthHandler>* handler) { |
175 std::string scheme = challenge->scheme(); | 175 std::string scheme = challenge->scheme(); |
176 if (scheme.empty()) { | 176 if (scheme.empty()) { |
177 handler->reset(); | 177 handler->reset(); |
178 return ERR_INVALID_RESPONSE; | 178 return ERR_INVALID_RESPONSE; |
179 } | 179 } |
180 std::string lower_scheme = base::ToLowerASCII(scheme); | 180 std::string lower_scheme = base::ToLowerASCII(scheme); |
181 FactoryMap::iterator it = factory_map_.find(lower_scheme); | 181 FactoryMap::iterator it = factory_map_.find(lower_scheme); |
182 if (it == factory_map_.end()) { | 182 if (it == factory_map_.end()) { |
183 handler->reset(); | 183 handler->reset(); |
184 return ERR_UNSUPPORTED_AUTH_SCHEME; | 184 return ERR_UNSUPPORTED_AUTH_SCHEME; |
185 } | 185 } |
186 DCHECK(it->second); | 186 DCHECK(it->second); |
187 return it->second->CreateAuthHandler(challenge, target, ssl_info, origin, | 187 return it->second->CreateAuthHandler(challenge, target, ssl_info, origin, |
188 reason, digest_nonce_count, net_log, | 188 reason, digest_nonce_count, net_log, |
189 handler); | 189 handler); |
190 } | 190 } |
191 | 191 |
192 } // namespace net | 192 } // namespace net |
OLD | NEW |