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

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

Issue 382313003: Add data reduction functionality to all platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch to run tests overnight. Created 6 years, 5 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 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" 5 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 } 45 }
46 } 46 }
47 return false; 47 return false;
48 } 48 }
49 49
50 bool GetDataReductionProxyInfo(const net::HttpResponseHeaders* headers, 50 bool GetDataReductionProxyInfo(const net::HttpResponseHeaders* headers,
51 DataReductionProxyInfo* proxy_info) { 51 DataReductionProxyInfo* proxy_info) {
52 DCHECK(proxy_info); 52 DCHECK(proxy_info);
53 proxy_info->bypass_all = false; 53 proxy_info->bypass_all = false;
54 proxy_info->bypass_duration = TimeDelta(); 54 // Randomize the timeout over a range from one to five minutes.
55 proxy_info->bypass_duration = TimeDelta::FromMilliseconds(
bengr 2014/07/15 16:38:17 This won't work. Leave this one as is and move thi
Not at Google. Contact bengr 2014/07/16 22:41:34 Done.
56 base::RandInt(1 * 60 * 1000, 5 * 60 * 1000));
55 // Support header of the form Chrome-Proxy: bypass|block=<duration>, where 57 // Support header of the form Chrome-Proxy: bypass|block=<duration>, where
56 // <duration> is the number of seconds to wait before retrying 58 // <duration> is the number of seconds to wait before retrying
57 // the proxy. If the duration is 0, then the default proxy retry delay 59 // the proxy. If the duration is 0, then the default proxy retry delay
58 // (specified in |ProxyList::UpdateRetryInfoOnFallback|) will be used. 60 // (specified in |ProxyList::UpdateRetryInfoOnFallback|) will be used.
59 // 'bypass' instructs Chrome to bypass the currently connected data reduction 61 // 'bypass' instructs Chrome to bypass the currently connected data reduction
60 // proxy, whereas 'block' instructs Chrome to bypass all available data 62 // proxy, whereas 'block' instructs Chrome to bypass all available data
61 // reduction proxies. 63 // reduction proxies.
62 64
63 // 'block' takes precedence over 'bypass', so look for it first. 65 // 'block' takes precedence over 'bypass', so look for it first.
64 // TODO(bengr): Reduce checks for 'block' and 'bypass' to a single loop. 66 // TODO(bengr): Reduce checks for 'block' and 'bypass' to a single loop.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) { 148 headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) {
147 return ProxyService::MISSING_VIA_HEADER_4XX; 149 return ProxyService::MISSING_VIA_HEADER_4XX;
148 } 150 }
149 return ProxyService::MISSING_VIA_HEADER_OTHER; 151 return ProxyService::MISSING_VIA_HEADER_OTHER;
150 } 152 }
151 // There is no bypass event. 153 // There is no bypass event.
152 return ProxyService::BYPASS_EVENT_TYPE_MAX; 154 return ProxyService::BYPASS_EVENT_TYPE_MAX;
153 } 155 }
154 156
155 } // namespace data_reduction_proxy 157 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698