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

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

Issue 1884453002: Revert of Convert //net and //chromecast to std::unordered_* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_server_properties_impl_unittest.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 <unordered_map>
14 #include <utility> 13 #include <utility>
15 14
16 #include "base/format_macros.h" 15 #include "base/format_macros.h"
17 #include "base/logging.h" 16 #include "base/logging.h"
18 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
19 #include "base/pickle.h" 18 #include "base/pickle.h"
20 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_piece.h" 20 #include "base/strings/string_piece.h"
22 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
23 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // header data, so we build a map from header name to generated header lines. 449 // header data, so we build a map from header name to generated header lines.
451 // to preserve the order of the original headers, the actual values are kept 450 // to preserve the order of the original headers, the actual values are kept
452 // in a separate list. finally, the list of headers is flattened to form 451 // in a separate list. finally, the list of headers is flattened to form
453 // the normalized block of headers. 452 // the normalized block of headers.
454 // 453 //
455 // NOTE: We take special care to preserve the whitespace around any commas 454 // NOTE: We take special care to preserve the whitespace around any commas
456 // that may occur in the original response headers. Because our consumer may 455 // that may occur in the original response headers. Because our consumer may
457 // be a web app, we cannot be certain of the semantics of commas despite the 456 // be a web app, we cannot be certain of the semantics of commas despite the
458 // fact that RFC 2616 says that they should be regarded as value separators. 457 // fact that RFC 2616 says that they should be regarded as value separators.
459 // 458 //
460 using HeadersMap = std::unordered_map<std::string, size_t>; 459 typedef base::hash_map<std::string, size_t> HeadersMap;
461 HeadersMap headers_map; 460 HeadersMap headers_map;
462 HeadersMap::iterator iter = headers_map.end(); 461 HeadersMap::iterator iter = headers_map.end();
463 462
464 std::vector<std::string> headers; 463 std::vector<std::string> headers;
465 464
466 for (size_t i = 0; i < parsed_.size(); ++i) { 465 for (size_t i = 0; i < parsed_.size(); ++i) {
467 DCHECK(!parsed_[i].is_continuation()); 466 DCHECK(!parsed_[i].is_continuation());
468 467
469 std::string name(parsed_[i].name_begin, parsed_[i].name_end); 468 std::string name(parsed_[i].name_begin, parsed_[i].name_end);
470 std::string lower_name = base::ToLowerASCII(name); 469 std::string lower_name = base::ToLowerASCII(name);
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 return true; 1451 return true;
1453 } 1452 }
1454 1453
1455 bool HttpResponseHeaders::IsChunkEncoded() const { 1454 bool HttpResponseHeaders::IsChunkEncoded() const {
1456 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies. 1455 // Ignore spurious chunked responses from HTTP/1.0 servers and proxies.
1457 return GetHttpVersion() >= HttpVersion(1, 1) && 1456 return GetHttpVersion() >= HttpVersion(1, 1) &&
1458 HasHeaderValue("Transfer-Encoding", "chunked"); 1457 HasHeaderValue("Transfer-Encoding", "chunked");
1459 } 1458 }
1460 1459
1461 } // namespace net 1460 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_headers.h ('k') | net/http/http_server_properties_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698