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

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"
(...skipping 23 matching lines...) Expand all
34 // Returns true if the Chrome-Proxy header is present and contains a bypass 34 // Returns true if the Chrome-Proxy header is present and contains a bypass
35 // delay. Sets |proxy_info->bypass_duration| to the specified delay if greater 35 // delay. Sets |proxy_info->bypass_duration| to the specified delay if greater
36 // than 0, and to 0 otherwise to indicate that the default proxy delay 36 // than 0, and to 0 otherwise to indicate that the default proxy delay
37 // (as specified in |ProxyList::UpdateRetryInfoOnFallback|) should be used. 37 // (as specified in |ProxyList::UpdateRetryInfoOnFallback|) should be used.
38 // If all available data reduction proxies should by bypassed, |bypass_all| is 38 // If all available data reduction proxies should by bypassed, |bypass_all| is
39 // set to true. |proxy_info| must be non-NULL. 39 // set to true. |proxy_info| must be non-NULL.
40 bool ParseHeadersAndSetProxyInfo(const net::HttpResponseHeaders* headers, 40 bool ParseHeadersAndSetProxyInfo(const net::HttpResponseHeaders* headers,
41 DataReductionProxyInfo* proxy_info); 41 DataReductionProxyInfo* proxy_info);
42 42
43 // Returns true if the response contains the data reduction proxy Via header 43 // Returns true if the response contains the data reduction proxy Via header
44 // value. Used to check the integrity of data reduction proxy responses. 44 // value. If non-NULL, sets |has_intermediary| to true if another server added
45 bool HasDataReductionProxyViaHeader(const net::HttpResponseHeaders* headers); 45 // a Via header after the data reduction proxy, and to false otherwise. Used to
46 // check the integrity of data reduction proxy responses and whether there are
47 // other middleboxes between the data reduction proxy and the client.
48 bool HasDataReductionProxyViaHeader(const net::HttpResponseHeaders* headers,
49 bool* has_intermediary);
46 50
47 // Returns the reason why the Chrome proxy should be bypassed or not, and 51 // Returns the reason why the Chrome proxy should be bypassed or not, and
48 // populates |proxy_info| with information on how long to bypass if 52 // populates |proxy_info| with information on how long to bypass if
49 // applicable. 53 // applicable.
50 net::ProxyService::DataReductionProxyBypassType GetDataReductionProxyBypassType( 54 net::ProxyService::DataReductionProxyBypassType GetDataReductionProxyBypassType(
51 const net::HttpResponseHeaders* headers, 55 const net::HttpResponseHeaders* headers,
52 DataReductionProxyInfo* proxy_info); 56 DataReductionProxyInfo* proxy_info);
53 57
58 // Searches for the specified Chrome-Proxy action, and if present saves its
59 // value as a string in |action_value|. Only returns the first one and ignores
60 // the rest if multiple actions match |action_prefix|.
61 bool GetDataReductionProxyActionValue(
62 const net::HttpResponseHeaders* headers,
63 const std::string& action_prefix,
64 std::string* action_value);
65
54 // Searches for the specified Chrome-Proxy action, and if present interprets 66 // Searches for the specified Chrome-Proxy action, and if present interprets
55 // its value as a duration in seconds. 67 // its value as a duration in seconds.
56 bool ParseHeadersAndSetBypassDuration(const net::HttpResponseHeaders* headers, 68 bool ParseHeadersAndSetBypassDuration(const net::HttpResponseHeaders* headers,
57 const std::string& action_prefix, 69 const std::string& action_prefix,
58 base::TimeDelta* bypass_duration); 70 base::TimeDelta* bypass_duration);
59 71
72 // Gets the fingerprint of the Chrome-Proxy header.
73 bool GetDataReductionProxyActionFingerprintChromeProxy(
74 const net::HttpResponseHeaders* headers,
75 std::string* chrome_proxy_fingerprint);
76
77 // Gets the fingerprint of the Via header.
78 bool GetDataReductionProxyActionFingerprintVia(
79 const net::HttpResponseHeaders* headers,
80 std::string* via_fingerprint);
81
82 // Gets the fingerprint of a list of headers.
83 bool GetDataReductionProxyActionFingerprintOtherHeaders(
84 const net::HttpResponseHeaders* headers,
85 std::string* other_headers_fingerprint);
86
87 // Gets the fingerprint of Content-Length header.
88 bool GetDataReductionProxyActionFingerprintContentLength(
89 const net::HttpResponseHeaders* headers,
90 std::string* content_length_fingerprint);
91
92 // Returns values of the Chrome-Proxy header, but with its fingerprint removed.
93 void GetDataReductionProxyHeaderWithFingerprintRemoved(
94 const net::HttpResponseHeaders* headers,
95 std::vector<std::string>* values);
96
60 } // namespace data_reduction_proxy 97 } // namespace data_reduction_proxy
61 #endif // COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H _ 98 #endif // COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698