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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 !event_param->GetAsDictionary(&dict) || | 1298 !event_param->GetAsDictionary(&dict) || |
1299 !dict->GetList("headers", &header_list)) { | 1299 !dict->GetList("headers", &header_list)) { |
1300 return false; | 1300 return false; |
1301 } | 1301 } |
1302 | 1302 |
1303 std::string raw_headers; | 1303 std::string raw_headers; |
1304 for (base::ListValue::const_iterator it = header_list->begin(); | 1304 for (base::ListValue::const_iterator it = header_list->begin(); |
1305 it != header_list->end(); | 1305 it != header_list->end(); |
1306 ++it) { | 1306 ++it) { |
1307 std::string header_line; | 1307 std::string header_line; |
1308 if (!it->GetAsString(&header_line)) | 1308 if (!(*it)->GetAsString(&header_line)) |
1309 return false; | 1309 return false; |
1310 | 1310 |
1311 raw_headers.append(header_line); | 1311 raw_headers.append(header_line); |
1312 raw_headers.push_back('\0'); | 1312 raw_headers.push_back('\0'); |
1313 } | 1313 } |
1314 raw_headers.push_back('\0'); | 1314 raw_headers.push_back('\0'); |
1315 *http_response_headers = new HttpResponseHeaders(raw_headers); | 1315 *http_response_headers = new HttpResponseHeaders(raw_headers); |
1316 return true; | 1316 return true; |
1317 } | 1317 } |
1318 | 1318 |
1319 bool HttpResponseHeaders::IsChunkEncoded() const { | 1319 bool HttpResponseHeaders::IsChunkEncoded() const { |
1320 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. | 1320 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. |
1321 return GetHttpVersion() >= HttpVersion(1, 1) && | 1321 return GetHttpVersion() >= HttpVersion(1, 1) && |
1322 HasHeaderValue("Transfer-Encoding", "chunked"); | 1322 HasHeaderValue("Transfer-Encoding", "chunked"); |
1323 } | 1323 } |
1324 | 1324 |
1325 } // namespace net | 1325 } // namespace net |
OLD | NEW |