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

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

Issue 387353003: Modify data_reduction_proxy_header to support tamper detection logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@work
Patch Set: after sync 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/http/http_response_headers.h" 12 #include "net/http/http_response_headers.h"
13 #include "net/proxy/proxy_service.h" 13 #include "net/proxy/proxy_service.h"
14 14
15 using net::ProxyService; 15 using net::ProxyService;
16 16
17 namespace data_reduction_proxy { 17 namespace data_reduction_proxy {
18 18
19 extern const char kChromeProxyActionFingerprintChromeProxy[];
20 extern const char kChromeProxyActionFingerprintVia[];
21 extern const char kChromeProxyActionFingerprintOtherHeaders[];
22 extern const char kChromeProxyActionFingerprintContentLength[];
23
19 // Contains instructions contained in the Chrome-Proxy header. 24 // Contains instructions contained in the Chrome-Proxy header.
20 struct DataReductionProxyInfo { 25 struct DataReductionProxyInfo {
21 DataReductionProxyInfo() : bypass_all(false) {} 26 DataReductionProxyInfo() : bypass_all(false) {}
22 27
23 // True if Chrome should bypass all available data reduction proxies. False 28 // True if Chrome should bypass all available data reduction proxies. False
24 // if only the currently connected data reduction proxy should be bypassed. 29 // if only the currently connected data reduction proxy should be bypassed.
25 bool bypass_all; 30 bool bypass_all;
26 31
27 // Amount of time to bypass the data reduction proxy or proxies. 32 // Amount of time to bypass the data reduction proxy or proxies.
28 base::TimeDelta bypass_duration; 33 base::TimeDelta bypass_duration;
29 }; 34 };
30 35
31 // Returns true if the Chrome-Proxy header is present and contains a bypass 36 // Returns true if the Chrome-Proxy header is present and contains a bypass
32 // delay. Sets |proxy_info->bypass_duration| to the specified delay if greater 37 // delay. Sets |proxy_info->bypass_duration| to the specified delay if greater
33 // than 0, and to 0 otherwise to indicate that the default proxy delay 38 // than 0, and to 0 otherwise to indicate that the default proxy delay
34 // (as specified in |ProxyList::UpdateRetryInfoOnFallback|) should be used. 39 // (as specified in |ProxyList::UpdateRetryInfoOnFallback|) should be used.
35 // If all available data reduction proxies should by bypassed, |bypass_all| is 40 // If all available data reduction proxies should by bypassed, |bypass_all| is
36 // set to true. |proxy_info| must be non-NULL. 41 // set to true. |proxy_info| must be non-NULL.
37 bool GetDataReductionProxyInfo( 42 bool GetDataReductionProxyInfo(
38 const net::HttpResponseHeaders* headers, 43 const net::HttpResponseHeaders* headers,
39 DataReductionProxyInfo* proxy_info); 44 DataReductionProxyInfo* proxy_info);
40 45
41 // Returns true if the response contain the data reduction proxy Via header 46 // Returns true if the response contain the data reduction proxy Via header
42 // value. Used to check the integrity of data reduction proxy responses. 47 // value. If non-NULL, sets |has_intermediary| to true if another server added
43 bool HasDataReductionProxyViaHeader(const net::HttpResponseHeaders* headers); 48 // a Via header after the data reduction proxy, and to false otherwise. Used to
49 // check the integrity of data reduction proxy responses and whether there are
50 // other middleboxes between data reduction proxy and chrome.
51 bool HasDataReductionProxyViaHeader(const net::HttpResponseHeaders* headers,
52 bool* has_intermediary);
44 53
45 // Returns the reason why the Chrome proxy should be bypassed or not, and 54 // Returns the reason why the Chrome proxy should be bypassed or not, and
46 // populates |proxy_info| with information on how long to bypass if 55 // populates |proxy_info| with information on how long to bypass if
47 // applicable. 56 // applicable.
48 ProxyService::DataReductionProxyBypassType GetDataReductionProxyBypassType( 57 ProxyService::DataReductionProxyBypassType GetDataReductionProxyBypassType(
49 const net::HttpResponseHeaders* headers, 58 const net::HttpResponseHeaders* headers,
50 DataReductionProxyInfo* proxy_info); 59 DataReductionProxyInfo* proxy_info);
51 60
61 // Searches for the specified Chrome-Proxy action, and if present saves its
62 // value as a string in |action_value|. Only keeps the first one and ignores
bolian 2014/07/28 22:59:18 s/keeps/returns/
xingx1 2014/07/29 00:47:40 Done.
63 // the rest if multiple actions match |action_prefix|.
64 bool GetDataReductionProxyActionValue(
65 const net::HttpResponseHeaders* headers,
66 const std::string& action_prefix,
67 std::string* action_value);
68
52 // Searches for the specified Chrome-Proxy action, and if present interprets 69 // Searches for the specified Chrome-Proxy action, and if present interprets
53 // its value as a duration in seconds. 70 // its value as a duration in seconds.
54 bool GetDataReductionProxyBypassDuration( 71 bool GetDataReductionProxyBypassDuration(
55 const net::HttpResponseHeaders* headers, 72 const net::HttpResponseHeaders* headers,
56 const std::string& action_prefix, 73 const std::string& action_prefix,
57 base::TimeDelta* duration); 74 base::TimeDelta* duration);
58 75
59 } // namespace data_reduction_proxy 76 } // namespace data_reduction_proxy
60 #endif // COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H _ 77 #endif // COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698