OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 | 855 |
856 if (result == ERR_CONNECTION_CLOSED) { | 856 if (result == ERR_CONNECTION_CLOSED) { |
857 // For now, if we get at least some data, we do the best we can to make | 857 // For now, if we get at least some data, we do the best we can to make |
858 // sense of it and send it back up the stack. | 858 // sense of it and send it back up the stack. |
859 int rv = HandleConnectionClosedBeforeEndOfHeaders(); | 859 int rv = HandleConnectionClosedBeforeEndOfHeaders(); |
860 if (rv != OK) | 860 if (rv != OK) |
861 return rv; | 861 return rv; |
862 } | 862 } |
863 DCHECK(response_.headers); | 863 DCHECK(response_.headers); |
864 | 864 |
| 865 // Server-induced fallback is supported only if this is a PAC configured |
| 866 // proxy. See: http://crbug.com/143712 |
| 867 if (response_.was_fetched_via_proxy && proxy_info_.did_use_pac_script()) { |
| 868 if (response_.headers != NULL && |
| 869 response_.headers->HasHeaderValue("connection", "proxy-bypass")) { |
| 870 ProxyService* proxy_service = session_->proxy_service(); |
| 871 if (proxy_service->MarkProxyAsBad(proxy_info_, net_log_)) { |
| 872 // Only retry in the case of GETs. We don't want to resubmit a POST |
| 873 // if the proxy took some action. |
| 874 if (request_->method == "GET") { |
| 875 ResetConnectionAndRequestForResend(); |
| 876 return OK; |
| 877 } |
| 878 } |
| 879 } |
| 880 } |
| 881 |
865 // Like Net.HttpResponseCode, but only for MAIN_FRAME loads. | 882 // Like Net.HttpResponseCode, but only for MAIN_FRAME loads. |
866 if (request_->load_flags & LOAD_MAIN_FRAME) { | 883 if (request_->load_flags & LOAD_MAIN_FRAME) { |
867 const int response_code = response_.headers->response_code(); | 884 const int response_code = response_.headers->response_code(); |
868 UMA_HISTOGRAM_ENUMERATION( | 885 UMA_HISTOGRAM_ENUMERATION( |
869 "Net.HttpResponseCode_Nxx_MainFrame", response_code/100, 10); | 886 "Net.HttpResponseCode_Nxx_MainFrame", response_code/100, 10); |
870 } | 887 } |
871 | 888 |
872 net_log_.AddEvent( | 889 net_log_.AddEvent( |
873 NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS, | 890 NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS, |
874 base::Bind(&HttpResponseHeaders::NetLogCallback, response_.headers)); | 891 base::Bind(&HttpResponseHeaders::NetLogCallback, response_.headers)); |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1449 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1433 state); | 1450 state); |
1434 break; | 1451 break; |
1435 } | 1452 } |
1436 return description; | 1453 return description; |
1437 } | 1454 } |
1438 | 1455 |
1439 #undef STATE_CASE | 1456 #undef STATE_CASE |
1440 | 1457 |
1441 } // namespace net | 1458 } // namespace net |
OLD | NEW |