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 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 return dict; | 1289 return dict; |
1290 } | 1290 } |
1291 | 1291 |
1292 // static | 1292 // static |
1293 bool HttpResponseHeaders::FromNetLogParam( | 1293 bool HttpResponseHeaders::FromNetLogParam( |
1294 const base::Value* event_param, | 1294 const base::Value* event_param, |
1295 scoped_refptr<HttpResponseHeaders>* http_response_headers) { | 1295 scoped_refptr<HttpResponseHeaders>* http_response_headers) { |
1296 *http_response_headers = NULL; | 1296 *http_response_headers = NULL; |
1297 | 1297 |
1298 const base::DictionaryValue* dict; | 1298 const base::DictionaryValue* dict; |
1299 const base::ListValue* header_list; | 1299 const base::ListValue* header_list = NULL; |
1300 | 1300 |
1301 if (!event_param || | 1301 if (!event_param || |
1302 !event_param->GetAsDictionary(&dict) || | 1302 !event_param->GetAsDictionary(&dict) || |
1303 !dict->GetList("headers", &header_list)) { | 1303 !dict->GetList("headers", &header_list)) { |
1304 return false; | 1304 return false; |
1305 } | 1305 } |
1306 | 1306 |
1307 std::string raw_headers; | 1307 std::string raw_headers; |
1308 for (base::ListValue::const_iterator it = header_list->begin(); | 1308 for (base::ListValue::const_iterator it = header_list->begin(); |
1309 it != header_list->end(); | 1309 it != header_list->end(); |
(...skipping 10 matching lines...) Expand all Loading... |
1320 return true; | 1320 return true; |
1321 } | 1321 } |
1322 | 1322 |
1323 bool HttpResponseHeaders::IsChunkEncoded() const { | 1323 bool HttpResponseHeaders::IsChunkEncoded() const { |
1324 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. | 1324 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. |
1325 return GetHttpVersion() >= HttpVersion(1, 1) && | 1325 return GetHttpVersion() >= HttpVersion(1, 1) && |
1326 HasHeaderValue("Transfer-Encoding", "chunked"); | 1326 HasHeaderValue("Transfer-Encoding", "chunked"); |
1327 } | 1327 } |
1328 | 1328 |
1329 } // namespace net | 1329 } // namespace net |
OLD | NEW |