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.h

Issue 836583002: Add support for field trial group to relax missing via header bypass logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unused include from aw_url_request_context_getter.cc Created 5 years, 11 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.h
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol.h
new file mode 100644
index 0000000000000000000000000000000000000000..5315803bb7ab4fafeca5f5b81e997af4a1296b81
--- /dev/null
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_protocol.h
@@ -0,0 +1,72 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_BYPASS_PROTOCOL_H_
+#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_BYPASS_PROTOCOL_H_
+
+#include <set>
+
+#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
+#include "net/base/host_port_pair.h"
+#include "net/base/network_change_notifier.h"
+
+namespace net {
+class URLRequest;
+}
+
+class GURL;
+
+namespace data_reduction_proxy {
+
+class DataReductionProxyEventStore;
+class DataReductionProxyParams;
+
+// Class responsible for determining when a response should or should not cause
+// the data reduction proxy to be bypassed, and to what degree. Owned by the
+// DataReductionProxyInterceptor.
+class DataReductionProxyBypassProtocol
+ : public net::NetworkChangeNotifier::IPAddressObserver {
+ public:
+ // Constructs a DataReductionProxyBypassProtocol object. |params| and
+ // |event_store| must be non-NULL and outlive |this|.
+ DataReductionProxyBypassProtocol(DataReductionProxyParams* params,
+ DataReductionProxyEventStore* event_store);
+
+ ~DataReductionProxyBypassProtocol() override;
+
+ // Decides whether to mark the data reduction proxy as temporarily bad and
+ // put it on the proxy retry map, which is maintained by the ProxyService of
+ // the URLRequestContext. Returns true if the request should be retried.
+ // Updates the load flags in |request| for some bypass types, e.g.,
+ // "block-once". Returns the DataReductionProxyBypassType (if not NULL).
+ bool MaybeBypassProxyAndPrepareToRetry(
+ net::URLRequest* request,
+ DataReductionProxyBypassType* proxy_bypass_type);
+
+ // Returns true if the request method is idempotent. Only idempotent requests
+ // are retried on a bypass. Visible as part of the public API for testing.
+ static bool IsRequestIdempotent(const net::URLRequest* request);
+
+ private:
+ // Override from NetworkChangeNotifier::IPAddressObserver:
+ void OnIPAddressChanged() override;
+
+ // Must outlive |this|.
+ DataReductionProxyParams* params_;
+
+ // Must outlive |this|.
+ DataReductionProxyEventStore* event_store_;
+
+ // The set of data reduction proxies through which a response has come back
+ // with the data reduction proxy via header since the last network change.
+ // This is only used if the client is part of the field trial to relax the
+ // bypass logic around missing via headers in non-4xx responses.
+ std::set<net::HostPortPair> via_header_producing_proxies_;
+
+ DISALLOW_COPY_AND_ASSIGN(DataReductionProxyBypassProtocol);
+};
+
+} // namespace data_reduction_proxy
+
+#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_BYPASS_PROTOCOL_H_

Powered by Google App Engine
This is Rietveld 408576698