Chromium Code Reviews| Index: components/data_reduction_proxy/common/data_reduction_proxy_headers.cc |
| diff --git a/components/data_reduction_proxy/common/data_reduction_proxy_headers.cc b/components/data_reduction_proxy/common/data_reduction_proxy_headers.cc |
| index e48afc366876e3aed082e133548044b45713a1f2..75142b0376c1f40d291448296c964a1809de977e 100644 |
| --- a/components/data_reduction_proxy/common/data_reduction_proxy_headers.cc |
| +++ b/components/data_reduction_proxy/common/data_reduction_proxy_headers.cc |
| @@ -23,6 +23,27 @@ namespace data_reduction_proxy { |
| const char* kDataReductionProxyViaValues[] = {"Chrome-Compression-Proxy", |
| "Chrome Compression Proxy"}; |
| +bool GetDataReductionProxyActionValue( |
| + const net::HttpResponseHeaders* headers, |
| + const std::string& action_prefix, |
| + std::string* action_value) { |
| + void* iter = NULL; |
| + std::string value; |
| + std::string name = "chrome-proxy"; |
|
bolian
2014/07/14 19:23:58
inline this in the func call. (Don't we have cons
xingx
2014/07/14 21:37:16
Acknowledged.
bolian
2014/07/14 22:42:43
?
xingx
2014/07/14 22:51:08
Copied code from below.
|
| + |
| + while (headers->EnumerateHeader(&iter, name, &value)) { |
| + if (value.size() > action_prefix.size()) { |
|
bolian
2014/07/14 19:23:59
>=? add a test case for that.
xingx
2014/07/14 21:37:16
Done.
It should be ">=" to get the empty value, b
|
| + if (LowerCaseEqualsASCII(value.begin(), |
| + value.begin() + action_prefix.size(), |
| + action_prefix.c_str())) { |
| + *action_value = value.substr(action_prefix.size()); |
|
bengr
2014/07/14 18:27:13
Before the loop, either DCHECK that action_value i
xingx
2014/07/14 21:37:16
Done.
|
| + return true; |
| + } |
| + } |
| + } |
| + return false; |
| +} |
| + |
| bool GetDataReductionProxyBypassDuration( |
| const net::HttpResponseHeaders* headers, |
| const std::string& action_prefix, |