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 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 proxy_info->bypass_all = true; | 1412 proxy_info->bypass_all = true; |
1413 return true; | 1413 return true; |
1414 } | 1414 } |
1415 | 1415 |
1416 // Next, look for 'bypass'. | 1416 // Next, look for 'bypass'. |
1417 if (GetChromeProxyBypassDuration("bypass=", &proxy_info->bypass_duration)) | 1417 if (GetChromeProxyBypassDuration("bypass=", &proxy_info->bypass_duration)) |
1418 return true; | 1418 return true; |
1419 | 1419 |
1420 return false; | 1420 return false; |
1421 } | 1421 } |
| 1422 |
| 1423 bool HttpResponseHeaders::IsChromeProxyResponse() const { |
| 1424 const size_t kVersionSize = 4; |
| 1425 const char kChromeProxyViaValue[] = "Chrome-Compression-Proxy"; |
| 1426 size_t value_len = strlen(kChromeProxyViaValue); |
| 1427 void* iter = NULL; |
| 1428 std::string value; |
| 1429 |
| 1430 // Case-sensitive comparison of |value|. Assumes the received protocol and the |
| 1431 // space following it are always |kVersionSize| characters. E.g., |
| 1432 // 'Via: 1.1 Chrome-Compression-Proxy' |
| 1433 while (EnumerateHeader(&iter, "via", &value)) { |
| 1434 if (!value.compare(kVersionSize, value_len, kChromeProxyViaValue)) |
| 1435 return true; |
| 1436 } |
| 1437 |
| 1438 // TODO(bengr): Remove deprecated header value. |
| 1439 const char kDeprecatedChromeProxyViaValue[] = "1.1 Chrome Compression Proxy"; |
| 1440 iter = NULL; |
| 1441 while (EnumerateHeader(&iter, "via", &value)) |
| 1442 if (value == kDeprecatedChromeProxyViaValue) |
| 1443 return true; |
| 1444 |
| 1445 return false; |
| 1446 } |
1422 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | 1447 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) |
1423 | 1448 |
1424 } // namespace net | 1449 } // namespace net |
OLD | NEW |