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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 } | 968 } |
969 #endif | 969 #endif |
970 | 970 |
971 if (chrome_proxy_used || chrome_fallback_proxy_used) { | 971 if (chrome_proxy_used || chrome_fallback_proxy_used) { |
972 if (response_.headers->GetChromeProxyInfo(&chrome_proxy_info)) { | 972 if (response_.headers->GetChromeProxyInfo(&chrome_proxy_info)) { |
973 if (chrome_proxy_info.bypass_duration < TimeDelta::FromMinutes(30)) | 973 if (chrome_proxy_info.bypass_duration < TimeDelta::FromMinutes(30)) |
974 proxy_bypass_event = ProxyService::SHORT_BYPASS; | 974 proxy_bypass_event = ProxyService::SHORT_BYPASS; |
975 else | 975 else |
976 proxy_bypass_event = ProxyService::LONG_BYPASS; | 976 proxy_bypass_event = ProxyService::LONG_BYPASS; |
977 } else { | 977 } else { |
978 // Additionally, fallback if a 500, 502 or 503 is returned via the data | 978 // Additionally, fallback if a 500 or 502 is returned via the data |
979 // reduction proxy. This is conservative, as the 500, 501 or 502 might | 979 // reduction proxy. This is conservative, as the 500 or 502 might have |
980 // have been generated by the origin, and not the proxy. | 980 // been generated by the origin, and not the proxy. |
981 if (response_.headers->response_code() == HTTP_INTERNAL_SERVER_ERROR || | 981 if (response_.headers->response_code() == HTTP_INTERNAL_SERVER_ERROR || |
982 response_.headers->response_code() == HTTP_BAD_GATEWAY || | 982 response_.headers->response_code() == HTTP_BAD_GATEWAY || |
983 response_.headers->response_code() == HTTP_SERVICE_UNAVAILABLE) { | 983 response_.headers->response_code() == HTTP_SERVICE_UNAVAILABLE) { |
984 proxy_bypass_event = ProxyService::INTERNAL_SERVER_ERROR_BYPASS; | 984 proxy_bypass_event = ProxyService::INTERNAL_SERVER_ERROR_BYPASS; |
985 } | 985 } |
986 } | 986 } |
987 | 987 |
988 if (proxy_bypass_event < ProxyService::BYPASS_EVENT_TYPE_MAX) { | 988 if (proxy_bypass_event < ProxyService::BYPASS_EVENT_TYPE_MAX) { |
989 ProxyService* proxy_service = session_->proxy_service(); | 989 ProxyService* proxy_service = session_->proxy_service(); |
990 | 990 |
(...skipping 10 matching lines...) Expand all Loading... |
1001 ProxyServer::SCHEME_HTTP : | 1001 ProxyServer::SCHEME_HTTP : |
1002 ProxyServer::SCHEME_HTTPS, | 1002 ProxyServer::SCHEME_HTTPS, |
1003 HostPortPair::FromURL(proxy_url)); | 1003 HostPortPair::FromURL(proxy_url)); |
1004 } | 1004 } |
1005 } | 1005 } |
1006 #endif | 1006 #endif |
1007 if (proxy_service->MarkProxiesAsBad(proxy_info_, | 1007 if (proxy_service->MarkProxiesAsBad(proxy_info_, |
1008 chrome_proxy_info.bypass_duration, | 1008 chrome_proxy_info.bypass_duration, |
1009 proxy_server, | 1009 proxy_server, |
1010 net_log_)) { | 1010 net_log_)) { |
1011 // Only retry idempotent methods. We don't want to resubmit a POST | 1011 // Only retry in the case of GETs. We don't want to resubmit a POST |
1012 // if the proxy took some action. | 1012 // if the proxy took some action. |
1013 if (request_->method == "GET" || | 1013 if (request_->method == "GET") { |
1014 request_->method == "OPTIONS" || | |
1015 request_->method == "HEAD" || | |
1016 request_->method == "PUT" || | |
1017 request_->method == "DELETE" || | |
1018 request_->method == "TRACE") { | |
1019 ResetConnectionAndRequestForResend(); | 1014 ResetConnectionAndRequestForResend(); |
1020 return OK; | 1015 return OK; |
1021 } | 1016 } |
1022 } | 1017 } |
1023 } | 1018 } |
1024 } | 1019 } |
1025 } | 1020 } |
1026 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | 1021 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
1027 | 1022 |
1028 // Like Net.HttpResponseCode, but only for MAIN_FRAME loads. | 1023 // Like Net.HttpResponseCode, but only for MAIN_FRAME loads. |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 1562 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
1568 state); | 1563 state); |
1569 break; | 1564 break; |
1570 } | 1565 } |
1571 return description; | 1566 return description; |
1572 } | 1567 } |
1573 | 1568 |
1574 #undef STATE_CASE | 1569 #undef STATE_CASE |
1575 | 1570 |
1576 } // namespace net | 1571 } // namespace net |
OLD | NEW |