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

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

Issue 2777823002: Bypass DRP if a redirect cycle is detected (Closed)
Patch Set: ryansturm comments Created 3 years, 8 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_CORE_COMMON_DATA_REDUCTION_PROXY_HEADERS _H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_HEADERS _H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_HEADERS _H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_HEADERS _H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "net/proxy/proxy_service.h" 14 #include "net/proxy/proxy_service.h"
14 15
16 class GURL;
17
15 namespace net { 18 namespace net {
16
17 class HttpResponseHeaders; 19 class HttpResponseHeaders;
18
19 } // namespace net 20 } // namespace net
20 21
21 namespace data_reduction_proxy { 22 namespace data_reduction_proxy {
22 23
23 // Values of the UMA DataReductionProxy.BypassType{Primary|Fallback} and 24 // Values of the UMA DataReductionProxy.BypassType{Primary|Fallback} and
24 // DataReductionProxy.BlockType{Primary|Fallback} histograms. This enum must 25 // DataReductionProxy.BlockType{Primary|Fallback} histograms. This enum must
25 // remain synchronized with the enum of the same name in 26 // remain synchronized with the enum of the same name in
26 // metrics/histograms/histograms.xml. 27 // metrics/histograms/histograms.xml.
27 enum DataReductionProxyBypassType { 28 enum DataReductionProxyBypassType {
28 #define BYPASS_EVENT_TYPE(label, value) BYPASS_EVENT_TYPE_ ## label = value, 29 #define BYPASS_EVENT_TYPE(label, value) BYPASS_EVENT_TYPE_ ## label = value,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Returns true if the Chrome-Proxy-Content-Transform response header indicates 120 // Returns true if the Chrome-Proxy-Content-Transform response header indicates
120 // that a lite page has been provided. 121 // that a lite page has been provided.
121 bool IsLitePagePreview(const net::HttpResponseHeaders& headers); 122 bool IsLitePagePreview(const net::HttpResponseHeaders& headers);
122 123
123 // Returns true if the Chrome-Proxy header is present and contains a bypass 124 // Returns true if the Chrome-Proxy header is present and contains a bypass
124 // delay. Sets |proxy_info->bypass_duration| to the specified delay if greater 125 // delay. Sets |proxy_info->bypass_duration| to the specified delay if greater
125 // than 0, and to 0 otherwise to indicate that the default proxy delay 126 // than 0, and to 0 otherwise to indicate that the default proxy delay
126 // (as specified in |ProxyList::UpdateRetryInfoOnFallback|) should be used. 127 // (as specified in |ProxyList::UpdateRetryInfoOnFallback|) should be used.
127 // If all available data reduction proxies should by bypassed, |bypass_all| is 128 // If all available data reduction proxies should by bypassed, |bypass_all| is
128 // set to true. |proxy_info| must be non-NULL. 129 // set to true. |proxy_info| must be non-NULL.
129 bool ParseHeadersForBypassInfo(const net::HttpResponseHeaders* headers, 130 bool ParseHeadersForBypassInfo(const net::HttpResponseHeaders& headers,
130 DataReductionProxyInfo* proxy_info); 131 DataReductionProxyInfo* proxy_info);
131 132
132 // Returns true if the response contains the data reduction proxy Via header 133 // Returns true if the response contains the data reduction proxy Via header
133 // value. If non-NULL, sets |has_intermediary| to true if another server added 134 // value. If non-NULL, sets |has_intermediary| to true if another server added
134 // a Via header after the data reduction proxy, and to false otherwise. Used to 135 // a Via header after the data reduction proxy, and to false otherwise. Used to
135 // check the integrity of data reduction proxy responses and whether there are 136 // check the integrity of data reduction proxy responses and whether there are
136 // other middleboxes between the data reduction proxy and the client. 137 // other middleboxes between the data reduction proxy and the client.
137 bool HasDataReductionProxyViaHeader(const net::HttpResponseHeaders* headers, 138 bool HasDataReductionProxyViaHeader(const net::HttpResponseHeaders& headers,
138 bool* has_intermediary); 139 bool* has_intermediary);
139 140
140 // Returns the reason why the Chrome proxy should be bypassed or not, and 141 // Returns the reason why the Chrome proxy should be bypassed or not, and
141 // populates |proxy_info| with information on how long to bypass if 142 // populates |proxy_info| with information on how long to bypass if
142 // applicable. 143 // applicable. |url_chain| is the chain of URLs traversed by the request.
143 DataReductionProxyBypassType GetDataReductionProxyBypassType( 144 DataReductionProxyBypassType GetDataReductionProxyBypassType(
144 const net::HttpResponseHeaders* headers, 145 const std::vector<GURL>& url_chain,
146 const net::HttpResponseHeaders& headers,
145 DataReductionProxyInfo* proxy_info); 147 DataReductionProxyInfo* proxy_info);
146 148
147 // Searches for the specified Chrome-Proxy action, and if present saves its 149 // Searches for the specified Chrome-Proxy action, and if present saves its
148 // value as a string in |action_value|. Only returns the first one and ignores 150 // value as a string in |action_value|. Only returns the first one and ignores
149 // the rest if multiple actions match |action_prefix|. 151 // the rest if multiple actions match |action_prefix|.
150 bool GetDataReductionProxyActionValue(const net::HttpResponseHeaders* headers, 152 bool GetDataReductionProxyActionValue(const net::HttpResponseHeaders* headers,
151 base::StringPiece action_prefix, 153 base::StringPiece action_prefix,
152 std::string* action_value); 154 std::string* action_value);
153 155
154 // Searches for the specified Chrome-Proxy action, and if present interprets 156 // Searches for the specified Chrome-Proxy action, and if present interprets
(...skipping 22 matching lines...) Expand all
177 const net::HttpResponseHeaders* headers, 179 const net::HttpResponseHeaders* headers,
178 std::string* content_length_fingerprint); 180 std::string* content_length_fingerprint);
179 181
180 // Returns values of the Chrome-Proxy header, but with its fingerprint removed. 182 // Returns values of the Chrome-Proxy header, but with its fingerprint removed.
181 void GetDataReductionProxyHeaderWithFingerprintRemoved( 183 void GetDataReductionProxyHeaderWithFingerprintRemoved(
182 const net::HttpResponseHeaders* headers, 184 const net::HttpResponseHeaders* headers,
183 std::vector<std::string>* values); 185 std::vector<std::string>* values);
184 186
185 } // namespace data_reduction_proxy 187 } // namespace data_reduction_proxy
186 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_HEAD ERS_H_ 188 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_COMMON_DATA_REDUCTION_PROXY_HEAD ERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698