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

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

Issue 314173002: Bypass data reduction proxy if no handler is found for a 407 error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@benpatch
Patch Set: Responded to comments by bengr. Created 6 years, 6 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 | « no previous file | net/proxy/proxy_service.h » ('j') | 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 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if (data_reduction_proxy_info->bypass_duration < TimeDelta::FromMinutes(30)) 114 if (data_reduction_proxy_info->bypass_duration < TimeDelta::FromMinutes(30))
115 return ProxyService::SHORT_BYPASS; 115 return ProxyService::SHORT_BYPASS;
116 return ProxyService::LONG_BYPASS; 116 return ProxyService::LONG_BYPASS;
117 } 117 }
118 if (headers->response_code() == net::HTTP_INTERNAL_SERVER_ERROR || 118 if (headers->response_code() == net::HTTP_INTERNAL_SERVER_ERROR ||
119 headers->response_code() == net::HTTP_BAD_GATEWAY || 119 headers->response_code() == net::HTTP_BAD_GATEWAY ||
120 headers->response_code() == net::HTTP_SERVICE_UNAVAILABLE) { 120 headers->response_code() == net::HTTP_SERVICE_UNAVAILABLE) {
121 // Fall back if a 500, 502 or 503 is returned. 121 // Fall back if a 500, 502 or 503 is returned.
122 return ProxyService::INTERNAL_SERVER_ERROR_BYPASS; 122 return ProxyService::INTERNAL_SERVER_ERROR_BYPASS;
123 } 123 }
124 if (headers->response_code() == net::HTTP_PROXY_AUTHENTICATION_REQUIRED
125 && !headers->HasHeader("Proxy-Authenticate")) {
bengr 2014/06/05 18:02:21 nit: I tend to put the && on the previous line.
Not at Google. Contact bengr 2014/06/05 20:21:23 Done.
126 return ProxyService::MALFORMED_407_BYPASS;
127 }
124 if (!IsDataReductionProxyResponse(headers) && 128 if (!IsDataReductionProxyResponse(headers) &&
125 (headers->response_code() != net::HTTP_NOT_MODIFIED)) { 129 (headers->response_code() != net::HTTP_NOT_MODIFIED)) {
126 // A Via header might not be present in a 304. Since the goal of a 304 130 // A Via header might not be present in a 304. Since the goal of a 304
127 // response is to minimize information transfer, a sender in general 131 // response is to minimize information transfer, a sender in general
128 // should not generate representation metadata other than Cache-Control, 132 // should not generate representation metadata other than Cache-Control,
129 // Content-Location, Date, ETag, Expires, and Vary. 133 // Content-Location, Date, ETag, Expires, and Vary.
130 134
131 // The proxy Via header might also not be present in a 4xx response. 135 // The proxy Via header might also not be present in a 4xx response.
132 // Separate this case from other responses that are missing the header. 136 // Separate this case from other responses that are missing the header.
133 if (headers->response_code() >= net::HTTP_BAD_REQUEST && 137 if (headers->response_code() >= net::HTTP_BAD_REQUEST &&
134 headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) { 138 headers->response_code() < net::HTTP_INTERNAL_SERVER_ERROR) {
135 return ProxyService::PROXY_4XX_BYPASS; 139 return ProxyService::PROXY_4XX_BYPASS;
136 } 140 }
137 return ProxyService::MISSING_VIA_HEADER; 141 return ProxyService::MISSING_VIA_HEADER;
138 } 142 }
139 // There is no bypass event. 143 // There is no bypass event.
140 return ProxyService::BYPASS_EVENT_TYPE_MAX; 144 return ProxyService::BYPASS_EVENT_TYPE_MAX;
141 } 145 }
142 146
143 } // namespace data_reduction_proxy 147 } // namespace data_reduction_proxy
OLDNEW
« no previous file with comments | « no previous file | net/proxy/proxy_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698