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