Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: net/http/http_network_transaction.cc

Issue 99283006: Retry idempotent methods on Chrome-Proxy: bypass (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 or 502 is returned via the data 978 // Additionally, fallback if a 500, 502 or 503 is returned via the data
979 // reduction proxy. This is conservative, as the 500 or 502 might have 979 // reduction proxy. This is conservative, as the 500, 501 or 502 might
980 // been generated by the origin, and not the proxy. 980 // have 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
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 in the case of GETs. We don't want to resubmit a POST 1011 // Only retry idempotent methods.
1012 // if the proxy took some action. 1012 if (request_->method == "GET" ||
1013 if (request_->method == "GET") { 1013 request_->method == "OPTIONS" ||
mef 2013/12/18 20:36:23 I'd keep 'We don't want to resubmit a POST if the
bengr 2013/12/18 21:05:10 Done.
1014 request_->method == "HEAD" ||
1015 request_->method == "PUT" ||
1016 request_->method == "DELETE" ||
1017 request_->method == "TRACE") {
1014 ResetConnectionAndRequestForResend(); 1018 ResetConnectionAndRequestForResend();
1015 return OK; 1019 return OK;
1016 } 1020 }
1017 } 1021 }
1018 } 1022 }
1019 } 1023 }
1020 } 1024 }
1021 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 1025 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
1022 1026
1023 // Like Net.HttpResponseCode, but only for MAIN_FRAME loads. 1027 // Like Net.HttpResponseCode, but only for MAIN_FRAME loads.
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 1566 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1563 state); 1567 state);
1564 break; 1568 break;
1565 } 1569 }
1566 return description; 1570 return description;
1567 } 1571 }
1568 1572
1569 #undef STATE_CASE 1573 #undef STATE_CASE
1570 1574
1571 } // namespace net 1575 } // namespace net
OLDNEW
« net/http/http_network_layer_unittest.cc ('K') | « net/http/http_network_layer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698