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

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

Issue 2037933002: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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_request_headers.cc ('k') | net/http/http_server_properties_impl.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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 *instance_length < 0 || *instance_length - 1 < *last_byte_position) 1409 *instance_length < 0 || *instance_length - 1 < *last_byte_position)
1410 return false; 1410 return false;
1411 1411
1412 return true; 1412 return true;
1413 } 1413 }
1414 1414
1415 std::unique_ptr<base::Value> HttpResponseHeaders::NetLogCallback( 1415 std::unique_ptr<base::Value> HttpResponseHeaders::NetLogCallback(
1416 NetLogCaptureMode capture_mode) const { 1416 NetLogCaptureMode capture_mode) const {
1417 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 1417 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
1418 base::ListValue* headers = new base::ListValue(); 1418 base::ListValue* headers = new base::ListValue();
1419 headers->Append(new base::StringValue(EscapeNonASCII(GetStatusLine()))); 1419 headers->AppendString(EscapeNonASCII(GetStatusLine()));
1420 size_t iterator = 0; 1420 size_t iterator = 0;
1421 std::string name; 1421 std::string name;
1422 std::string value; 1422 std::string value;
1423 while (EnumerateHeaderLines(&iterator, &name, &value)) { 1423 while (EnumerateHeaderLines(&iterator, &name, &value)) {
1424 std::string log_value = 1424 std::string log_value =
1425 ElideHeaderValueForNetLog(capture_mode, name, value); 1425 ElideHeaderValueForNetLog(capture_mode, name, value);
1426 std::string escaped_name = EscapeNonASCII(name); 1426 std::string escaped_name = EscapeNonASCII(name);
1427 std::string escaped_value = EscapeNonASCII(log_value); 1427 std::string escaped_value = EscapeNonASCII(log_value);
1428 headers->Append( 1428 headers->AppendString(base::StringPrintf("%s: %s", escaped_name.c_str(),
1429 new base::StringValue( 1429 escaped_value.c_str()));
1430 base::StringPrintf("%s: %s", escaped_name.c_str(),
1431 escaped_value.c_str())));
1432 } 1430 }
1433 dict->Set("headers", headers); 1431 dict->Set("headers", headers);
1434 return std::move(dict); 1432 return std::move(dict);
1435 } 1433 }
1436 1434
1437 // static 1435 // static
1438 bool HttpResponseHeaders::FromNetLogParam( 1436 bool HttpResponseHeaders::FromNetLogParam(
1439 const base::Value* event_param, 1437 const base::Value* event_param,
1440 scoped_refptr<HttpResponseHeaders>* http_response_headers) { 1438 scoped_refptr<HttpResponseHeaders>* http_response_headers) {
1441 *http_response_headers = NULL; 1439 *http_response_headers = NULL;
(...skipping 23 matching lines...) Expand all
1465 return true; 1463 return true;
1466 } 1464 }
1467 1465
1468 bool HttpResponseHeaders::IsChunkEncoded() const { 1466 bool HttpResponseHeaders::IsChunkEncoded() const {
1469 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. 1467 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies.
1470 return GetHttpVersion() >= HttpVersion(1, 1) && 1468 return GetHttpVersion() >= HttpVersion(1, 1) &&
1471 HasHeaderValue("Transfer-Encoding", "chunked"); 1469 HasHeaderValue("Transfer-Encoding", "chunked");
1472 } 1470 }
1473 1471
1474 } // namespace net 1472 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_request_headers.cc ('k') | net/http/http_server_properties_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698