summaryrefslogtreecommitdiffstats
path: root/components/data_reduction_proxy/common/data_reduction_proxy_headers.h
diff options
context:
space:
mode:
authorxingx@chromium.org <xingx@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-05 18:04:32 +0000
committerxingx@chromium.org <xingx@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-05 18:04:32 +0000
commit0dbf12022b283cb383fde607344a556a42fe8b28 (patch)
tree83c3b1a808452501f41e4e0b407882d98cb242e8 /components/data_reduction_proxy/common/data_reduction_proxy_headers.h
parent3c625c84114901c9866bddfe1abed858da13e538 (diff)
downloadchromium_src-0dbf12022b283cb383fde607344a556a42fe8b28.zip
chromium_src-0dbf12022b283cb383fde607344a556a42fe8b28.tar.gz
chromium_src-0dbf12022b283cb383fde607344a556a42fe8b28.tar.bz2
1. Adds action-parsing functionality for data reduction proxy header.
2. Adds a couple of functions to return different fingerprint value for tamper detection. 3. Adds a function to remove Chrome-Proxy header's fingerprint from its header values, and return the rest of header values. 4. Changes HasDataReductionProxyViaHeader to also tell whether data reduction proxy Via header occurs at the last or not. BUG=381907 Review URL: https://codereview.chromium.org/387353003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287561 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/data_reduction_proxy/common/data_reduction_proxy_headers.h')
-rw-r--r--components/data_reduction_proxy/common/data_reduction_proxy_headers.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/components/data_reduction_proxy/common/data_reduction_proxy_headers.h b/components/data_reduction_proxy/common/data_reduction_proxy_headers.h
index 28eccee..319d90d 100644
--- a/components/data_reduction_proxy/common/data_reduction_proxy_headers.h
+++ b/components/data_reduction_proxy/common/data_reduction_proxy_headers.h
@@ -41,8 +41,12 @@ bool ParseHeadersAndSetProxyInfo(const net::HttpResponseHeaders* headers,
DataReductionProxyInfo* proxy_info);
// Returns true if the response contains the data reduction proxy Via header
-// value. Used to check the integrity of data reduction proxy responses.
-bool HasDataReductionProxyViaHeader(const net::HttpResponseHeaders* headers);
+// value. If non-NULL, sets |has_intermediary| to true if another server added
+// a Via header after the data reduction proxy, and to false otherwise. Used to
+// check the integrity of data reduction proxy responses and whether there are
+// other middleboxes between the data reduction proxy and the client.
+bool HasDataReductionProxyViaHeader(const net::HttpResponseHeaders* headers,
+ bool* has_intermediary);
// Returns the reason why the Chrome proxy should be bypassed or not, and
// populates |proxy_info| with information on how long to bypass if
@@ -51,11 +55,44 @@ net::ProxyService::DataReductionProxyBypassType GetDataReductionProxyBypassType(
const net::HttpResponseHeaders* headers,
DataReductionProxyInfo* proxy_info);
+// Searches for the specified Chrome-Proxy action, and if present saves its
+// value as a string in |action_value|. Only returns the first one and ignores
+// the rest if multiple actions match |action_prefix|.
+bool GetDataReductionProxyActionValue(
+ const net::HttpResponseHeaders* headers,
+ const std::string& action_prefix,
+ std::string* action_value);
+
// Searches for the specified Chrome-Proxy action, and if present interprets
// its value as a duration in seconds.
bool ParseHeadersAndSetBypassDuration(const net::HttpResponseHeaders* headers,
const std::string& action_prefix,
base::TimeDelta* bypass_duration);
+// Gets the fingerprint of the Chrome-Proxy header.
+bool GetDataReductionProxyActionFingerprintChromeProxy(
+ const net::HttpResponseHeaders* headers,
+ std::string* chrome_proxy_fingerprint);
+
+// Gets the fingerprint of the Via header.
+bool GetDataReductionProxyActionFingerprintVia(
+ const net::HttpResponseHeaders* headers,
+ std::string* via_fingerprint);
+
+// Gets the fingerprint of a list of headers.
+bool GetDataReductionProxyActionFingerprintOtherHeaders(
+ const net::HttpResponseHeaders* headers,
+ std::string* other_headers_fingerprint);
+
+// Gets the fingerprint of Content-Length header.
+bool GetDataReductionProxyActionFingerprintContentLength(
+ const net::HttpResponseHeaders* headers,
+ std::string* content_length_fingerprint);
+
+// Returns values of the Chrome-Proxy header, but with its fingerprint removed.
+void GetDataReductionProxyHeaderWithFingerprintRemoved(
+ const net::HttpResponseHeaders* headers,
+ std::vector<std::string>* values);
+
} // namespace data_reduction_proxy
#endif // COMPONENTS_DATA_REDUCTION_PROXY_COMMON_DATA_REDUCTION_PROXY_HEADERS_H_