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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol.cc

Issue 2001243002: Change POST-exclusion to idempotent-inclusion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing unneeded header, streamlining method Created 4 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol.cc
index 1d0349a0e2493849316fa649fc696a3ae8d89d9b..7b3220e0f8a96096e13d23e255054dafbd68c74a 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol.cc
@@ -6,20 +6,21 @@
#include <vector>
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h"
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_util.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
#include "net/proxy/proxy_config.h"
#include "net/proxy/proxy_info.h"
#include "net/proxy/proxy_list.h"
#include "net/proxy/proxy_retry_info.h"
#include "net/proxy/proxy_server.h"
#include "net/proxy/proxy_service.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
@@ -160,28 +161,14 @@ bool DataReductionProxyBypassProtocol::MaybeBypassProxyAndPrepareToRetry(
data_reduction_proxy_info->bypass_all,
data_reduction_proxy_type_info.proxy_servers);
} else {
request->SetLoadFlags(request->load_flags() |
net::LOAD_DISABLE_CACHE |
net::LOAD_BYPASS_PROXY);
}
// Retry if block-once was specified or if method is idempotent.
return bypass_type == BYPASS_EVENT_TYPE_CURRENT ||
- IsRequestIdempotent(request);
-}
-
-// static
-bool DataReductionProxyBypassProtocol::IsRequestIdempotent(
- const net::URLRequest* request) {
- DCHECK(request);
- if (request->method() == "GET" ||
- request->method() == "OPTIONS" ||
- request->method() == "HEAD" ||
- request->method() == "PUT" ||
- request->method() == "DELETE" ||
- request->method() == "TRACE")
- return true;
- return false;
+ IsMethodIdempotent(request->method());
}
} // namespace data_reduction_proxy

Powered by Google App Engine
This is Rietveld 408576698