| 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.h" | 5 #include "net/http/http_auth.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/http/http_auth_challenge_tokenizer.h" | 13 #include "net/http/http_auth_challenge_tokenizer.h" |
| 14 #include "net/http/http_auth_handler.h" | 14 #include "net/http/http_auth_handler.h" |
| 15 #include "net/http/http_auth_handler_factory.h" | 15 #include "net/http/http_auth_handler_factory.h" |
| 16 #include "net/http/http_request_headers.h" | 16 #include "net/http/http_request_headers.h" |
| 17 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
| 18 #include "net/http/http_util.h" | 18 #include "net/http/http_util.h" |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 | 21 |
| 22 HttpAuth::Identity::Identity() : source(IDENT_SRC_NONE), invalid(true) {} | 22 HttpAuth::Identity::Identity() : source(IDENT_SRC_NONE), invalid(true) {} |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 void HttpAuth::ChooseBestChallenge( | 25 void HttpAuth::ChooseBestChallenge( |
| 26 HttpAuthHandlerFactory* http_auth_handler_factory, | 26 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 27 const HttpResponseHeaders* headers, | 27 const HttpResponseHeaders* headers, |
| 28 Target target, | 28 Target target, |
| 29 const GURL& origin, | 29 const url::Origin& origin, |
| 30 const std::set<Scheme>& disabled_schemes, | 30 const std::set<Scheme>& disabled_schemes, |
| 31 const BoundNetLog& net_log, | 31 const BoundNetLog& net_log, |
| 32 scoped_ptr<HttpAuthHandler>* handler) { | 32 scoped_ptr<HttpAuthHandler>* handler) { |
| 33 DCHECK(http_auth_handler_factory); | 33 DCHECK(http_auth_handler_factory); |
| 34 DCHECK(handler->get() == NULL); | 34 DCHECK(handler->get() == NULL); |
| 35 | 35 |
| 36 // Choose the challenge whose authentication handler gives the maximum score. | 36 // Choose the challenge whose authentication handler gives the maximum score. |
| 37 scoped_ptr<HttpAuthHandler> best; | 37 scoped_ptr<HttpAuthHandler> best; |
| 38 const std::string header_name = GetChallengeHeaderName(target); | 38 const std::string header_name = GetChallengeHeaderName(target); |
| 39 std::string cur_challenge; | 39 std::string cur_challenge; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 static_assert(arraysize(kSchemeNames) == AUTH_SCHEME_MAX, | 140 static_assert(arraysize(kSchemeNames) == AUTH_SCHEME_MAX, |
| 141 "http auth scheme names incorrect size"); | 141 "http auth scheme names incorrect size"); |
| 142 if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) { | 142 if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) { |
| 143 NOTREACHED(); | 143 NOTREACHED(); |
| 144 return "invalid_scheme"; | 144 return "invalid_scheme"; |
| 145 } | 145 } |
| 146 return kSchemeNames[scheme]; | 146 return kSchemeNames[scheme]; |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace net | 149 } // namespace net |
| OLD | NEW |