OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/trace_event.h" | 10 #include "base/trace_event.h" |
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 | 1235 |
1236 // Pick a new auth identity to try, by looking to the URL and auth cache. | 1236 // Pick a new auth identity to try, by looking to the URL and auth cache. |
1237 // If an identity to try is found, it is saved to auth_identity_[target]. | 1237 // If an identity to try is found, it is saved to auth_identity_[target]. |
1238 bool has_identity_to_try = SelectNextAuthIdentityToTry(target); | 1238 bool has_identity_to_try = SelectNextAuthIdentityToTry(target); |
1239 DCHECK(has_identity_to_try == !auth_identity_[target].invalid); | 1239 DCHECK(has_identity_to_try == !auth_identity_[target].invalid); |
1240 | 1240 |
1241 if (has_identity_to_try) { | 1241 if (has_identity_to_try) { |
1242 DCHECK(user_callback_); | 1242 DCHECK(user_callback_); |
1243 PrepareForAuthRestart(target); | 1243 PrepareForAuthRestart(target); |
1244 return WILL_RESTART_TRANSACTION; | 1244 return WILL_RESTART_TRANSACTION; |
1245 } else { | |
1246 // We have exhausted all identity possibilities, all we can do now is | |
1247 // pass the challenge information back to the client. | |
1248 PopulateAuthChallenge(target); | |
1249 } | 1245 } |
1250 | 1246 |
| 1247 // We have exhausted all identity possibilities, all we can do now is |
| 1248 // pass the challenge information back to the client. |
| 1249 PopulateAuthChallenge(target); |
1251 return OK; | 1250 return OK; |
1252 } | 1251 } |
1253 | 1252 |
1254 void HttpNetworkTransaction::PopulateAuthChallenge(HttpAuth::Target target) { | 1253 void HttpNetworkTransaction::PopulateAuthChallenge(HttpAuth::Target target) { |
1255 // Populates response_.auth_challenge with the authentication challenge info. | 1254 // Populates response_.auth_challenge with the authentication challenge info. |
1256 // This info is consumed by URLRequestHttpJob::GetAuthChallengeInfo(). | 1255 // This info is consumed by URLRequestHttpJob::GetAuthChallengeInfo(). |
1257 | 1256 |
1258 AuthChallengeInfo* auth_info = new AuthChallengeInfo; | 1257 AuthChallengeInfo* auth_info = new AuthChallengeInfo; |
1259 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY; | 1258 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY; |
1260 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme()); | 1259 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme()); |
1261 // TODO(eroman): decode realm according to RFC 2047. | 1260 // TODO(eroman): decode realm according to RFC 2047. |
1262 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm()); | 1261 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm()); |
1263 if (target == HttpAuth::AUTH_PROXY) { | 1262 if (target == HttpAuth::AUTH_PROXY) { |
1264 auth_info->host = ASCIIToWide(proxy_info_.proxy_server()); | 1263 auth_info->host = ASCIIToWide(proxy_info_.proxy_server()); |
1265 } else { | 1264 } else { |
1266 DCHECK(target == HttpAuth::AUTH_SERVER); | 1265 DCHECK(target == HttpAuth::AUTH_SERVER); |
1267 auth_info->host = ASCIIToWide(request_->url.host()); | 1266 auth_info->host = ASCIIToWide(request_->url.host()); |
1268 } | 1267 } |
1269 response_.auth_challenge = auth_info; | 1268 response_.auth_challenge = auth_info; |
1270 } | 1269 } |
1271 | 1270 |
1272 } // namespace net | 1271 } // namespace net |
OLD | NEW |