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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 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_network_transaction_unittest.cc ('k') | net/http/http_server_properties_impl.h » ('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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 // "close" in 1.0 is not strictly standards-compliant, but we'd like to 1207 // "close" in 1.0 is not strictly standards-compliant, but we'd like to
1208 // avoid looking at the Proxy-Connection header whenever it is reasonable to do 1208 // avoid looking at the Proxy-Connection header whenever it is reasonable to do
1209 // so. 1209 // so.
1210 // TODO(ricea): Measure real-world usage of the "Proxy-Connection" header, 1210 // TODO(ricea): Measure real-world usage of the "Proxy-Connection" header,
1211 // with a view to reducing support for it in order to make our Connection header 1211 // with a view to reducing support for it in order to make our Connection header
1212 // handling more RFC 7230 compliant. 1212 // handling more RFC 7230 compliant.
1213 bool HttpResponseHeaders::IsKeepAlive() const { 1213 bool HttpResponseHeaders::IsKeepAlive() const {
1214 // NOTE: It is perhaps risky to assume that a Proxy-Connection header is 1214 // NOTE: It is perhaps risky to assume that a Proxy-Connection header is
1215 // meaningful when we don't know that this response was from a proxy, but 1215 // meaningful when we don't know that this response was from a proxy, but
1216 // Mozilla also does this, so we'll do the same. 1216 // Mozilla also does this, so we'll do the same.
1217 static const char* kConnectionHeaders[] = {"connection", "proxy-connection"}; 1217 static const char* const kConnectionHeaders[] = {
1218 "connection", "proxy-connection"};
1218 struct KeepAliveToken { 1219 struct KeepAliveToken {
1219 const char* token; 1220 const char* const token;
1220 bool keep_alive; 1221 bool keep_alive;
1221 }; 1222 };
1222 static const KeepAliveToken kKeepAliveTokens[] = {{"keep-alive", true}, 1223 static const KeepAliveToken kKeepAliveTokens[] = {{"keep-alive", true},
1223 {"close", false}}; 1224 {"close", false}};
1224 1225
1225 if (http_version_ < HttpVersion(1, 0)) 1226 if (http_version_ < HttpVersion(1, 0))
1226 return false; 1227 return false;
1227 1228
1228 for (const char* header : kConnectionHeaders) { 1229 for (const char* header : kConnectionHeaders) {
1229 void* iterator = nullptr; 1230 void* iterator = nullptr;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 return true; 1443 return true;
1443 } 1444 }
1444 1445
1445 bool HttpResponseHeaders::IsChunkEncoded() const { 1446 bool HttpResponseHeaders::IsChunkEncoded() const {
1446 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. 1447 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies.
1447 return GetHttpVersion() >= HttpVersion(1, 1) && 1448 return GetHttpVersion() >= HttpVersion(1, 1) &&
1448 HasHeaderValue("Transfer-Encoding", "chunked"); 1449 HasHeaderValue("Transfer-Encoding", "chunked");
1449 } 1450 }
1450 1451
1451 } // namespace net 1452 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_server_properties_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698