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

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

Issue 1569673002: [NOT FOR LANDING] Detailed loading traces Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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_cache_transaction.cc ('k') | net/http/http_response_info.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"
11 11
12 #include <algorithm> 12 #include <algorithm>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/trace_event/trace_event.h"
15 #include "base/format_macros.h" 16 #include "base/format_macros.h"
16 #include "base/logging.h" 17 #include "base/logging.h"
17 #include "base/metrics/histogram_macros.h" 18 #include "base/metrics/histogram_macros.h"
18 #include "base/pickle.h" 19 #include "base/pickle.h"
19 #include "base/strings/string_number_conversions.h" 20 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/string_piece.h" 21 #include "base/strings/string_piece.h"
21 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
22 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
23 #include "base/time/time.h" 24 #include "base/time/time.h"
24 #include "base/values.h" 25 #include "base/values.h"
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 EnumerateHeader(nullptr, "Date", &date_header); 1245 EnumerateHeader(nullptr, "Date", &date_header);
1245 return HttpUtil::HasStrongValidators(GetHttpVersion(), 1246 return HttpUtil::HasStrongValidators(GetHttpVersion(),
1246 etag_header, 1247 etag_header,
1247 last_modified_header, 1248 last_modified_header,
1248 date_header); 1249 date_header);
1249 } 1250 }
1250 1251
1251 // From RFC 2616: 1252 // From RFC 2616:
1252 // Content-Length = "Content-Length" ":" 1*DIGIT 1253 // Content-Length = "Content-Length" ":" 1*DIGIT
1253 int64_t HttpResponseHeaders::GetContentLength() const { 1254 int64_t HttpResponseHeaders::GetContentLength() const {
1255 TRACE_EVENT0("toplevel", "HttpResponseHeaders::GetContentLength");
1254 return GetInt64HeaderValue("content-length"); 1256 return GetInt64HeaderValue("content-length");
1255 } 1257 }
1256 1258
1257 int64_t HttpResponseHeaders::GetInt64HeaderValue( 1259 int64_t HttpResponseHeaders::GetInt64HeaderValue(
1258 const std::string& header) const { 1260 const std::string& header) const {
1259 size_t iter = 0; 1261 size_t iter = 0;
1260 std::string content_length_val; 1262 std::string content_length_val;
1261 if (!EnumerateHeader(&iter, header, &content_length_val)) 1263 if (!EnumerateHeader(&iter, header, &content_length_val))
1262 return -1; 1264 return -1;
1263 1265
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 return true; 1444 return true;
1443 } 1445 }
1444 1446
1445 bool HttpResponseHeaders::IsChunkEncoded() const { 1447 bool HttpResponseHeaders::IsChunkEncoded() const {
1446 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. 1448 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies.
1447 return GetHttpVersion() >= HttpVersion(1, 1) && 1449 return GetHttpVersion() >= HttpVersion(1, 1) &&
1448 HasHeaderValue("Transfer-Encoding", "chunked"); 1450 HasHeaderValue("Transfer-Encoding", "chunked");
1449 } 1451 }
1450 1452
1451 } // namespace net 1453 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache_transaction.cc ('k') | net/http/http_response_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698