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

Side by Side Diff: net/http/http_response_headers.cc

Issue 156373002: Support for new data reduction proxy via header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 6 years, 10 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 | « net/http/http_response_headers.h ('k') | net/http/http_response_headers_unittest.cc » ('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 (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
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. Assumes the received protocol and the space
1431 // following it are always |kVersionSize| characters. E.g.,
1432 // 'Via: 1.1 Chrome-Compression-Proxy'
1433 while (EnumerateHeader(&iter, "via", &value)) {
mef 2014/02/12 18:12:19 If it is case sensitive, shouldn't it be 'Via' ins
bengr 2014/02/12 21:14:00 The value comparison is case sensitive. The Header
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) return true;
1443
1444 return false;
1445 }
1422 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) 1446 #endif // defined(SPDY_PROXY_AUTH_ORIGIN)
1423 1447
1424 } // namespace net 1448 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_headers.h ('k') | net/http/http_response_headers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698