| 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 1410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 | 1421 |
| 1422 auth_identity_[target].invalid = true; | 1422 auth_identity_[target].invalid = true; |
| 1423 | 1423 |
| 1424 // Find the best authentication challenge that we support. | 1424 // Find the best authentication challenge that we support. |
| 1425 HttpAuth::ChooseBestChallenge(response_.headers.get(), | 1425 HttpAuth::ChooseBestChallenge(response_.headers.get(), |
| 1426 target, | 1426 target, |
| 1427 &auth_handler_[target]); | 1427 &auth_handler_[target]); |
| 1428 | 1428 |
| 1429 if (!auth_handler_[target]) { | 1429 if (!auth_handler_[target]) { |
| 1430 if (establishing_tunnel_) { | 1430 if (establishing_tunnel_) { |
| 1431 // Log an error message to help debug http://crbug.com/8771. |
| 1432 std::string auth_target(target == HttpAuth::AUTH_PROXY ? |
| 1433 "proxy" : "server"); |
| 1434 LOG(ERROR) << "Can't perform auth to the " << auth_target << " " |
| 1435 << AuthOrigin(target).spec() |
| 1436 << " when establishing a tunnel"; |
| 1437 |
| 1438 std::string challenge; |
| 1439 void* iter = NULL; |
| 1440 while (response_.headers->EnumerateHeader(&iter, "Proxy-Authenticate", |
| 1441 &challenge)) { |
| 1442 LOG(ERROR) << " Has header Proxy-Authenticate: " << challenge; |
| 1443 } |
| 1444 |
| 1445 iter = NULL; |
| 1446 while (response_.headers->EnumerateHeader(&iter, "WWW-Authenticate", |
| 1447 &challenge)) { |
| 1448 LOG(ERROR) << " Has header WWW-Authenticate: " << challenge; |
| 1449 } |
| 1450 |
| 1431 // We are establishing a tunnel, we can't show the error page because an | 1451 // We are establishing a tunnel, we can't show the error page because an |
| 1432 // active network attacker could control its contents. Instead, we just | 1452 // active network attacker could control its contents. Instead, we just |
| 1433 // fail to establish the tunnel. | 1453 // fail to establish the tunnel. |
| 1434 DCHECK(target == HttpAuth::AUTH_PROXY); | 1454 DCHECK(target == HttpAuth::AUTH_PROXY); |
| 1435 return ERR_PROXY_AUTH_REQUESTED; | 1455 return ERR_PROXY_AUTH_REQUESTED; |
| 1436 } | 1456 } |
| 1437 // We found no supported challenge -- let the transaction continue | 1457 // We found no supported challenge -- let the transaction continue |
| 1438 // so we end up displaying the error page. | 1458 // so we end up displaying the error page. |
| 1439 return OK; | 1459 return OK; |
| 1440 } | 1460 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 if (target == HttpAuth::AUTH_PROXY) { | 1501 if (target == HttpAuth::AUTH_PROXY) { |
| 1482 auth_info->host = ASCIIToWide(proxy_info_.proxy_server().host_and_port()); | 1502 auth_info->host = ASCIIToWide(proxy_info_.proxy_server().host_and_port()); |
| 1483 } else { | 1503 } else { |
| 1484 DCHECK(target == HttpAuth::AUTH_SERVER); | 1504 DCHECK(target == HttpAuth::AUTH_SERVER); |
| 1485 auth_info->host = ASCIIToWide(request_->url.host()); | 1505 auth_info->host = ASCIIToWide(request_->url.host()); |
| 1486 } | 1506 } |
| 1487 response_.auth_challenge = auth_info; | 1507 response_.auth_challenge = auth_info; |
| 1488 } | 1508 } |
| 1489 | 1509 |
| 1490 } // namespace net | 1510 } // namespace net |
| OLD | NEW |