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

Side by Side Diff: net/spdy/header_coalescer.cc

Issue 2141993002: Remove many-many SpdyMajorVersion and NextProto arguments and members. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove OnSynStream() and OnSynReply(). Created 4 years, 5 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/spdy/header_coalescer.h ('k') | net/spdy/spdy_http_stream.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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 #include "net/spdy/header_coalescer.h" 5 #include "net/spdy/header_coalescer.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 8
9 namespace net { 9 namespace net {
10 10
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 // 32 byte overhead according to RFC 7540 Section 6.5.2. 24 // 32 byte overhead according to RFC 7540 Section 6.5.2.
25 header_list_size_ += key.size() + value.size() + 32; 25 header_list_size_ += key.size() + value.size() + 32;
26 if (header_list_size_ > kMaxHeaderListSize) { 26 if (header_list_size_ > kMaxHeaderListSize) {
27 error_seen_ = true; 27 error_seen_ = true;
28 return; 28 return;
29 } 29 }
30 30
31 if (key[0] == ':') { 31 if (key[0] == ':') {
32 if (protocol_version_ == HTTP2 && regular_header_seen_) { 32 if (regular_header_seen_) {
33 error_seen_ = true; 33 error_seen_ = true;
34 return; 34 return;
35 } 35 }
36 } else { 36 } else {
37 regular_header_seen_ = true; 37 regular_header_seen_ = true;
38 } 38 }
39 39
40 auto iter = headers_.find(key); 40 auto iter = headers_.find(key);
41 if (iter == headers_.end()) { 41 if (iter == headers_.end()) {
42 headers_[key] = value; 42 headers_[key] = value;
43 } else { 43 } else {
44 // This header had multiple values, so it must be reconstructed. 44 // This header had multiple values, so it must be reconstructed.
45 base::StringPiece v = iter->second; 45 base::StringPiece v = iter->second;
46 std::string s(v.data(), v.length()); 46 std::string s(v.data(), v.length());
47 if (key == "cookie") { 47 if (key == "cookie") {
48 // Obeys section 8.1.2.5 in RFC 7540 for cookie reconstruction. 48 // Obeys section 8.1.2.5 in RFC 7540 for cookie reconstruction.
49 s.append("; "); 49 s.append("; ");
50 } else { 50 } else {
51 base::StringPiece("\0", 1).AppendToString(&s); 51 base::StringPiece("\0", 1).AppendToString(&s);
52 } 52 }
53 value.AppendToString(&s); 53 value.AppendToString(&s);
54 headers_.ReplaceOrAppendHeader(key, s); 54 headers_.ReplaceOrAppendHeader(key, s);
55 } 55 }
56 } 56 }
57 57
58 } // namespace net 58 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/header_coalescer.h ('k') | net/spdy/spdy_http_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698