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

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

Issue 651433003: Change MISSING_VIA_HEADER_4XX bypasses to only last 1 second. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test case Created 6 years, 2 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
« no previous file with comments | « components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <vector> 8 #include <vector>
9 9
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 (headers->response_code() != net::HTTP_NOT_MODIFIED)) { 233 (headers->response_code() != net::HTTP_NOT_MODIFIED)) {
234 // A Via header might not be present in a 304. Since the goal of a 304 234 // A Via header might not be present in a 304. Since the goal of a 304
235 // response is to minimize information transfer, a sender in general 235 // response is to minimize information transfer, a sender in general
236 // should not generate representation metadata other than Cache-Control, 236 // should not generate representation metadata other than Cache-Control,
237 // Content-Location, Date, ETag, Expires, and Vary. 237 // Content-Location, Date, ETag, Expires, and Vary.
238 238
239 // The proxy Via header might also not be present in a 4xx response. 239 // The proxy Via header might also not be present in a 4xx response.
240 // Separate this case from other responses that are missing the header. 240 // Separate this case from other responses that are missing the header.
241 if (headers->response_code() >= net::HTTP_BAD_REQUEST && 241 if (headers->response_code() >= net::HTTP_BAD_REQUEST &&
242 headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) { 242 headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) {
243 // At this point, any 4xx response that is missing the via header
244 // indicates an issue that is scoped to only the current request, so only
245 // bypass the data reduction proxy for a second.
246 // TODO(sclittle): Change this to only bypass the current request once
247 // that is fully supported, see http://crbug.com/418342.
248 data_reduction_proxy_info->bypass_duration = TimeDelta::FromSeconds(1);
243 return BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_4XX; 249 return BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_4XX;
244 } 250 }
245 return BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_OTHER; 251 return BYPASS_EVENT_TYPE_MISSING_VIA_HEADER_OTHER;
246 } 252 }
247 // There is no bypass event. 253 // There is no bypass event.
248 return BYPASS_EVENT_TYPE_MAX; 254 return BYPASS_EVENT_TYPE_MAX;
249 } 255 }
250 256
251 bool GetDataReductionProxyActionFingerprintChromeProxy( 257 bool GetDataReductionProxyActionFingerprintChromeProxy(
252 const net::HttpResponseHeaders* headers, 258 const net::HttpResponseHeaders* headers,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 value.begin() + chrome_proxy_fingerprint_prefix.size(), 306 value.begin() + chrome_proxy_fingerprint_prefix.size(),
301 chrome_proxy_fingerprint_prefix.c_str())) { 307 chrome_proxy_fingerprint_prefix.c_str())) {
302 continue; 308 continue;
303 } 309 }
304 } 310 }
305 values->push_back(value); 311 values->push_back(value);
306 } 312 }
307 } 313 }
308 314
309 } // namespace data_reduction_proxy 315 } // namespace data_reduction_proxy
OLDNEW
« no previous file with comments | « components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698