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

Side by Side Diff: components/data_reduction_proxy/common/data_reduction_proxy_headers.h

Issue 467823002: Added support for 'Chrome-Proxy: block-once' header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased on master Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "net/proxy/proxy_service.h" 12 #include "net/proxy/proxy_service.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 class HttpResponseHeaders; 16 class HttpResponseHeaders;
17 17
18 } // namespace net 18 } // namespace net
19 19
20 namespace data_reduction_proxy { 20 namespace data_reduction_proxy {
21 21
22 // Values of the UMA DataReductionProxy.BypassType{Primary|Fallback} 22 // Values of the UMA DataReductionProxy.BypassType{Primary|Fallback}
23 // and DataReductionProxy.BlockType{Primary|Fallback} histograms. 23 // and DataReductionProxy.BlockType{Primary|Fallback} histograms.
24 // This enum must remain synchronized with the enum of the same 24 // This enum must remain synchronized with the enum of the same
25 // name in metrics/histograms/histograms.xml. 25 // name in metrics/histograms/histograms.xml.
26 enum DataReductionProxyBypassType { 26 enum DataReductionProxyBypassType {
27 // Bypass due to explicit instruction for the current request. 27 // Bypass due to explicit instruction for the current request.
28 // Not yet supported.
29 BYPASS_EVENT_TYPE_CURRENT = 0, 28 BYPASS_EVENT_TYPE_CURRENT = 0,
30 29
31 // Bypass the proxy for less than one minute. 30 // Bypass the proxy for less than one minute.
32 BYPASS_EVENT_TYPE_SHORT = 1, 31 BYPASS_EVENT_TYPE_SHORT = 1,
33 32
34 // Bypass the proxy for one to five minutes. 33 // Bypass the proxy for one to five minutes.
35 BYPASS_EVENT_TYPE_MEDIUM = 2, 34 BYPASS_EVENT_TYPE_MEDIUM = 2,
36 35
37 // Bypass the proxy for more than five minutes. 36 // Bypass the proxy for more than five minutes.
38 BYPASS_EVENT_TYPE_LONG = 3, 37 BYPASS_EVENT_TYPE_LONG = 3,
(...skipping 18 matching lines...) Expand all
57 56
58 // Bypass due to any network error. 57 // Bypass due to any network error.
59 BYPASS_EVENT_TYPE_NETWORK_ERROR = 10, 58 BYPASS_EVENT_TYPE_NETWORK_ERROR = 10,
60 59
61 // This must always be last. 60 // This must always be last.
62 BYPASS_EVENT_TYPE_MAX = 11 61 BYPASS_EVENT_TYPE_MAX = 11
63 }; 62 };
64 63
65 // Contains instructions contained in the Chrome-Proxy header. 64 // Contains instructions contained in the Chrome-Proxy header.
66 struct DataReductionProxyInfo { 65 struct DataReductionProxyInfo {
67 DataReductionProxyInfo() : bypass_all(false) {} 66 DataReductionProxyInfo()
67 : bypass_all(false), mark_proxies_as_bad(false) {}
68 68
69 // True if Chrome should bypass all available data reduction proxies. False 69 // True if Chrome should bypass all available data reduction proxies. False
70 // if only the currently connected data reduction proxy should be bypassed. 70 // if only the currently connected data reduction proxy should be bypassed.
71 bool bypass_all; 71 bool bypass_all;
72 72
73 // Amount of time to bypass the data reduction proxy or proxies. 73 // True iff Chrome should mark the data reduction proxy or proxies as bad for
74 // the period of time specified in |bypass_duration|.
75 bool mark_proxies_as_bad;
76
77 // Amount of time to bypass the data reduction proxy or proxies. This value is
78 // ignored if |mark_proxies_as_bad| is false.
74 base::TimeDelta bypass_duration; 79 base::TimeDelta bypass_duration;
75 }; 80 };
76 81
77 // Returns true if the Chrome-Proxy header is present and contains a bypass 82 // Returns true if the Chrome-Proxy header is present and contains a bypass
78 // delay. Sets |proxy_info->bypass_duration| to the specified delay if greater 83 // delay. Sets |proxy_info->bypass_duration| to the specified delay if greater
79 // than 0, and to 0 otherwise to indicate that the default proxy delay 84 // than 0, and to 0 otherwise to indicate that the default proxy delay
80 // (as specified in |ProxyList::UpdateRetryInfoOnFallback|) should be used. 85 // (as specified in |ProxyList::UpdateRetryInfoOnFallback|) should be used.
81 // If all available data reduction proxies should by bypassed, |bypass_all| is 86 // If all available data reduction proxies should by bypassed, |bypass_all| is
82 // set to true. |proxy_info| must be non-NULL. 87 // set to true. |proxy_info| must be non-NULL.
83 bool ParseHeadersAndSetProxyInfo(const net::HttpResponseHeaders* headers, 88 bool ParseHeadersAndSetProxyInfo(const net::HttpResponseHeaders* headers,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 const net::HttpResponseHeaders* headers, 137 const net::HttpResponseHeaders* headers,
133 std::string* content_length_fingerprint); 138 std::string* content_length_fingerprint);
134 139
135 // Returns values of the Chrome-Proxy header, but with its fingerprint removed. 140 // Returns values of the Chrome-Proxy header, but with its fingerprint removed.
136 void GetDataReductionProxyHeaderWithFingerprintRemoved( 141 void GetDataReductionProxyHeaderWithFingerprintRemoved(
137 const net::HttpResponseHeaders* headers, 142 const net::HttpResponseHeaders* headers,
138 std::vector<std::string>* values); 143 std::vector<std::string>* values);
139 144
140 } // namespace data_reduction_proxy 145 } // namespace data_reduction_proxy
141 #endif // COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H _ 146 #endif // COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698