OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The rules for header parsing were borrowed from Firefox: | 5 // The rules for header parsing were borrowed from Firefox: |
6 // http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/http/src/nsHttpRespo nseHead.cpp | 6 // http://lxr.mozilla.org/seamonkey/source/netwerk/protocol/http/src/nsHttpRespo nseHead.cpp |
7 // The rules for parsing content-types were also borrowed from Firefox: | 7 // The rules for parsing content-types were also borrowed from Firefox: |
8 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 | 8 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 |
9 | 9 |
10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1497 response_code() == HTTP_SERVICE_UNAVAILABLE) { | 1497 response_code() == HTTP_SERVICE_UNAVAILABLE) { |
1498 // Fall back if a 500, 502 or 503 is returned. | 1498 // Fall back if a 500, 502 or 503 is returned. |
1499 return ProxyService::INTERNAL_SERVER_ERROR_BYPASS; | 1499 return ProxyService::INTERNAL_SERVER_ERROR_BYPASS; |
1500 } | 1500 } |
1501 if (!IsDataReductionProxyResponse() && | 1501 if (!IsDataReductionProxyResponse() && |
1502 (response_code() != HTTP_NOT_MODIFIED)) { | 1502 (response_code() != HTTP_NOT_MODIFIED)) { |
1503 // A Via header might not be present in a 304. Since the goal of a 304 | 1503 // A Via header might not be present in a 304. Since the goal of a 304 |
1504 // response is to minimize information transfer, a sender in general | 1504 // response is to minimize information transfer, a sender in general |
1505 // should not generate representation metadata other than Cache-Control, | 1505 // should not generate representation metadata other than Cache-Control, |
1506 // Content-Location, Date, ETag, Expires, and Vary. | 1506 // Content-Location, Date, ETag, Expires, and Vary. |
1507 | |
1508 // A Via header might also not be present in a 4xx response. If there is | |
1509 // evidence that the 4xx response was generated by the proxy, bypass it. | |
1510 if (response_code() >= HTTP_BAD_REQUEST && | |
1511 response_code() < HTTP_INTERNAL_SERVER_ERROR) { | |
1512 // If the data reduction proxy ever deprecates use of this "Server" | |
1513 // header, a 4xx response from the proxy will be interpreted as | |
1514 // a response that is missing a "Via" header. Either way, the proxy will | |
1515 // be bypassed. | |
1516 if (HasHeaderValue("Server", "GFE/2.0")) | |
1517 return ProxyService::PROXY_4XX_BYPASS; | |
mef
2014/05/29 16:41:38
I'm still uneasy about hardcoded "GFE/2.0", and I'
bengr
2014/05/29 18:46:19
OK
| |
1518 // Otherwise, bypass on the missing Via header. | |
1519 } | |
1507 return ProxyService::MISSING_VIA_HEADER; | 1520 return ProxyService::MISSING_VIA_HEADER; |
1508 } | 1521 } |
1509 // There is no bypass event. | 1522 // There is no bypass event. |
1510 return ProxyService::BYPASS_EVENT_TYPE_MAX; | 1523 return ProxyService::BYPASS_EVENT_TYPE_MAX; |
1511 } | 1524 } |
1512 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | 1525 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
1513 | 1526 |
1514 } // namespace net | 1527 } // namespace net |
OLD | NEW |