| 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/strings/string_tokenizer.h" | 9 #include "base/strings/string_tokenizer.h" | 
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 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& response_headers, | 27     const HttpResponseHeaders& response_headers, | 
| 28     const SSLInfo& ssl_info, | 28     const SSLInfo& ssl_info, | 
| 29     Target target, | 29     Target target, | 
| 30     const GURL& origin, | 30     const GURL& origin, | 
| 31     const std::set<Scheme>& disabled_schemes, | 31     const std::set<Scheme>& disabled_schemes, | 
| 32     const BoundNetLog& net_log, | 32     const NetLogWithSource& net_log, | 
| 33     std::unique_ptr<HttpAuthHandler>* handler) { | 33     std::unique_ptr<HttpAuthHandler>* handler) { | 
| 34   DCHECK(http_auth_handler_factory); | 34   DCHECK(http_auth_handler_factory); | 
| 35   DCHECK(handler->get() == NULL); | 35   DCHECK(handler->get() == NULL); | 
| 36 | 36 | 
| 37   // Choose the challenge whose authentication handler gives the maximum score. | 37   // Choose the challenge whose authentication handler gives the maximum score. | 
| 38   std::unique_ptr<HttpAuthHandler> best; | 38   std::unique_ptr<HttpAuthHandler> best; | 
| 39   const std::string header_name = GetChallengeHeaderName(target); | 39   const std::string header_name = GetChallengeHeaderName(target); | 
| 40   std::string cur_challenge; | 40   std::string cur_challenge; | 
| 41   size_t iter = 0; | 41   size_t iter = 0; | 
| 42   while (response_headers.EnumerateHeader(&iter, header_name, &cur_challenge)) { | 42   while (response_headers.EnumerateHeader(&iter, header_name, &cur_challenge)) { | 
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 136   static_assert(arraysize(kSchemeNames) == AUTH_SCHEME_MAX, | 136   static_assert(arraysize(kSchemeNames) == AUTH_SCHEME_MAX, | 
| 137                 "http auth scheme names incorrect size"); | 137                 "http auth scheme names incorrect size"); | 
| 138   if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) { | 138   if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) { | 
| 139     NOTREACHED(); | 139     NOTREACHED(); | 
| 140     return "invalid_scheme"; | 140     return "invalid_scheme"; | 
| 141   } | 141   } | 
| 142   return kSchemeNames[scheme]; | 142   return kSchemeNames[scheme]; | 
| 143 } | 143 } | 
| 144 | 144 | 
| 145 }  // namespace net | 145 }  // namespace net | 
| OLD | NEW | 
|---|