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

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

Issue 1135373002: Updated NetLog::ParametersCallback & all related calbacks returning value as scoped_ptr<base::Value… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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_stream_factory_impl_job.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 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 1384
1385 // We have all the values; let's verify that they make sense for a 206 1385 // We have all the values; let's verify that they make sense for a 206
1386 // response. 1386 // response.
1387 if (*first_byte_position < 0 || *last_byte_position < 0 || 1387 if (*first_byte_position < 0 || *last_byte_position < 0 ||
1388 *instance_length < 0 || *instance_length - 1 < *last_byte_position) 1388 *instance_length < 0 || *instance_length - 1 < *last_byte_position)
1389 return false; 1389 return false;
1390 1390
1391 return true; 1391 return true;
1392 } 1392 }
1393 1393
1394 base::Value* HttpResponseHeaders::NetLogCallback( 1394 scoped_ptr<base::Value> HttpResponseHeaders::NetLogCallback(
1395 NetLogCaptureMode capture_mode) const { 1395 NetLogCaptureMode capture_mode) const {
1396 base::DictionaryValue* dict = new base::DictionaryValue(); 1396 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
1397 base::ListValue* headers = new base::ListValue(); 1397 scoped_ptr<base::ListValue> headers(new base::ListValue());
1398 headers->Append(new base::StringValue(GetStatusLine())); 1398 headers->Append(new base::StringValue(GetStatusLine()));
1399 void* iterator = NULL; 1399 void* iterator = NULL;
1400 std::string name; 1400 std::string name;
1401 std::string value; 1401 std::string value;
1402 while (EnumerateHeaderLines(&iterator, &name, &value)) { 1402 while (EnumerateHeaderLines(&iterator, &name, &value)) {
1403 std::string log_value = 1403 std::string log_value =
1404 ElideHeaderValueForNetLog(capture_mode, name, value); 1404 ElideHeaderValueForNetLog(capture_mode, name, value);
1405 std::string escaped_name = EscapeNonASCII(name); 1405 std::string escaped_name = EscapeNonASCII(name);
1406 std::string escaped_value = EscapeNonASCII(log_value); 1406 std::string escaped_value = EscapeNonASCII(log_value);
1407 headers->Append( 1407 headers->Append(
1408 new base::StringValue( 1408 new base::StringValue(
1409 base::StringPrintf("%s: %s", escaped_name.c_str(), 1409 base::StringPrintf("%s: %s", escaped_name.c_str(),
1410 escaped_value.c_str()))); 1410 escaped_value.c_str())));
1411 } 1411 }
1412 dict->Set("headers", headers); 1412 dict->Set("headers", headers.Pass());
1413 return dict; 1413 return dict.Pass();
1414 } 1414 }
1415 1415
1416 // static 1416 // static
1417 bool HttpResponseHeaders::FromNetLogParam( 1417 bool HttpResponseHeaders::FromNetLogParam(
1418 const base::Value* event_param, 1418 const base::Value* event_param,
1419 scoped_refptr<HttpResponseHeaders>* http_response_headers) { 1419 scoped_refptr<HttpResponseHeaders>* http_response_headers) {
1420 *http_response_headers = NULL; 1420 *http_response_headers = NULL;
1421 1421
1422 const base::DictionaryValue* dict = NULL; 1422 const base::DictionaryValue* dict = NULL;
1423 const base::ListValue* header_list = NULL; 1423 const base::ListValue* header_list = NULL;
(...skipping 20 matching lines...) Expand all
1444 return true; 1444 return true;
1445 } 1445 }
1446 1446
1447 bool HttpResponseHeaders::IsChunkEncoded() const { 1447 bool HttpResponseHeaders::IsChunkEncoded() const {
1448 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. 1448 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies.
1449 return GetHttpVersion() >= HttpVersion(1, 1) && 1449 return GetHttpVersion() >= HttpVersion(1, 1) &&
1450 HasHeaderValue("Transfer-Encoding", "chunked"); 1450 HasHeaderValue("Transfer-Encoding", "chunked");
1451 } 1451 }
1452 1452
1453 } // namespace net 1453 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_headers.h ('k') | net/http/http_stream_factory_impl_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698