| 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.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/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 12 #include "net/http/http_auth_handler_basic.h" | 12 #include "net/http/http_auth_handler_basic.h" |
| 13 #include "net/http/http_auth_handler_digest.h" | 13 #include "net/http/http_auth_handler_digest.h" |
| 14 #include "net/http/http_auth_handler_negotiate.h" | 14 #include "net/http/http_auth_handler_negotiate.h" |
| 15 #include "net/http/http_auth_handler_ntlm.h" | 15 #include "net/http/http_auth_handler_ntlm.h" |
| 16 #include "net/http/http_request_headers.h" |
| 16 #include "net/http/http_response_headers.h" | 17 #include "net/http/http_response_headers.h" |
| 17 #include "net/http/http_util.h" | 18 #include "net/http/http_util.h" |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 | 21 |
| 21 HttpAuth::Identity::Identity() : source(IDENT_SRC_NONE), invalid(true) {} | 22 HttpAuth::Identity::Identity() : source(IDENT_SRC_NONE), invalid(true) {} |
| 22 | 23 |
| 23 // static | 24 // static |
| 24 void HttpAuth::ChooseBestChallenge( | 25 void HttpAuth::ChooseBestChallenge( |
| 25 HttpAuthHandlerFactory* http_auth_handler_factory, | 26 HttpAuthHandlerFactory* http_auth_handler_factory, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 default: | 136 default: |
| 136 NOTREACHED(); | 137 NOTREACHED(); |
| 137 return ""; | 138 return ""; |
| 138 } | 139 } |
| 139 } | 140 } |
| 140 | 141 |
| 141 // static | 142 // static |
| 142 std::string HttpAuth::GetAuthorizationHeaderName(Target target) { | 143 std::string HttpAuth::GetAuthorizationHeaderName(Target target) { |
| 143 switch (target) { | 144 switch (target) { |
| 144 case AUTH_PROXY: | 145 case AUTH_PROXY: |
| 145 return "Proxy-Authorization"; | 146 return HttpRequestHeaders::kProxyAuthorization; |
| 146 case AUTH_SERVER: | 147 case AUTH_SERVER: |
| 147 return "Authorization"; | 148 return HttpRequestHeaders::kAuthorization; |
| 148 default: | 149 default: |
| 149 NOTREACHED(); | 150 NOTREACHED(); |
| 150 return ""; | 151 return ""; |
| 151 } | 152 } |
| 152 } | 153 } |
| 153 | 154 |
| 154 // static | 155 // static |
| 155 std::string HttpAuth::GetAuthTargetString(Target target) { | 156 std::string HttpAuth::GetAuthTargetString(Target target) { |
| 156 switch (target) { | 157 switch (target) { |
| 157 case AUTH_PROXY: | 158 case AUTH_PROXY: |
| (...skipping 18 matching lines...) Expand all Loading... |
| 176 COMPILE_ASSERT(arraysize(kSchemeNames) == AUTH_SCHEME_MAX, | 177 COMPILE_ASSERT(arraysize(kSchemeNames) == AUTH_SCHEME_MAX, |
| 177 http_auth_scheme_names_incorrect_size); | 178 http_auth_scheme_names_incorrect_size); |
| 178 if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) { | 179 if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) { |
| 179 NOTREACHED(); | 180 NOTREACHED(); |
| 180 return "invalid_scheme"; | 181 return "invalid_scheme"; |
| 181 } | 182 } |
| 182 return kSchemeNames[scheme]; | 183 return kSchemeNames[scheme]; |
| 183 } | 184 } |
| 184 | 185 |
| 185 } // namespace net | 186 } // namespace net |
| OLD | NEW |