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 (HasHeaderValue("Server", "GFE/2.0")) | |
mef
2014/05/28 15:39:57
Um, why do you need to hardcode GFE here?
bengr
2014/05/29 16:09:48
A missing via header with this server error indica
| |
1513 return ProxyService::PROXY_4XX_BYPASS; | |
1514 // Otherwise, bypass on the missing Via header. | |
1515 } | |
1507 return ProxyService::MISSING_VIA_HEADER; | 1516 return ProxyService::MISSING_VIA_HEADER; |
1508 } | 1517 } |
1509 // There is no bypass event. | 1518 // There is no bypass event. |
1510 return ProxyService::BYPASS_EVENT_TYPE_MAX; | 1519 return ProxyService::BYPASS_EVENT_TYPE_MAX; |
1511 } | 1520 } |
1512 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | 1521 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
1513 | 1522 |
1514 } // namespace net | 1523 } // namespace net |
OLD | NEW |