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 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 !event_param->GetAsDictionary(&dict) || | 1328 !event_param->GetAsDictionary(&dict) || |
1329 !dict->GetList("headers", &header_list)) { | 1329 !dict->GetList("headers", &header_list)) { |
1330 return false; | 1330 return false; |
1331 } | 1331 } |
1332 | 1332 |
1333 std::string raw_headers; | 1333 std::string raw_headers; |
1334 for (base::ListValue::const_iterator it = header_list->begin(); | 1334 for (base::ListValue::const_iterator it = header_list->begin(); |
1335 it != header_list->end(); | 1335 it != header_list->end(); |
1336 ++it) { | 1336 ++it) { |
1337 std::string header_line; | 1337 std::string header_line; |
1338 if (!(*it)->GetAsString(&header_line)) | 1338 if (!it->GetAsString(&header_line)) |
1339 return false; | 1339 return false; |
1340 | 1340 |
1341 raw_headers.append(header_line); | 1341 raw_headers.append(header_line); |
1342 raw_headers.push_back('\0'); | 1342 raw_headers.push_back('\0'); |
1343 } | 1343 } |
1344 raw_headers.push_back('\0'); | 1344 raw_headers.push_back('\0'); |
1345 *http_response_headers = new HttpResponseHeaders(raw_headers); | 1345 *http_response_headers = new HttpResponseHeaders(raw_headers); |
1346 return true; | 1346 return true; |
1347 } | 1347 } |
1348 | 1348 |
1349 bool HttpResponseHeaders::IsChunkEncoded() const { | 1349 bool HttpResponseHeaders::IsChunkEncoded() const { |
1350 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. | 1350 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. |
1351 return GetHttpVersion() >= HttpVersion(1, 1) && | 1351 return GetHttpVersion() >= HttpVersion(1, 1) && |
1352 HasHeaderValue("Transfer-Encoding", "chunked"); | 1352 HasHeaderValue("Transfer-Encoding", "chunked"); |
1353 } | 1353 } |
1354 | 1354 |
1355 } // namespace net | 1355 } // namespace net |
OLD | NEW |