OLD | NEW |
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/chromium/header_coalescer.h" | 5 #include "net/spdy/chromium/header_coalescer.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 auto dict = base::MakeUnique<base::DictionaryValue>(); | 24 auto dict = base::MakeUnique<base::DictionaryValue>(); |
25 dict->SetString("header_name", header_name); | 25 dict->SetString("header_name", header_name); |
26 dict->SetString("header_value", ElideHeaderValueForNetLog( | 26 dict->SetString("header_value", ElideHeaderValueForNetLog( |
27 capture_mode, header_name.as_string(), | 27 capture_mode, header_name.as_string(), |
28 header_value.as_string())); | 28 header_value.as_string())); |
29 return std::move(dict); | 29 return std::move(dict); |
30 } | 30 } |
31 | 31 |
32 } // namespace | 32 } // namespace |
33 | 33 |
34 const size_t kMaxHeaderListSize = 256 * 1024; | |
35 | |
36 HeaderCoalescer::HeaderCoalescer(const NetLogWithSource& net_log) | 34 HeaderCoalescer::HeaderCoalescer(const NetLogWithSource& net_log) |
37 : net_log_(net_log) {} | 35 : net_log_(net_log) {} |
38 | 36 |
39 void HeaderCoalescer::OnHeader(SpdyStringPiece key, SpdyStringPiece value) { | 37 void HeaderCoalescer::OnHeader(SpdyStringPiece key, SpdyStringPiece value) { |
40 if (error_seen_) | 38 if (error_seen_) |
41 return; | 39 return; |
42 if (!AddHeader(key, value)) { | 40 if (!AddHeader(key, value)) { |
43 error_seen_ = true; | 41 error_seen_ = true; |
44 if (net_log_.IsCapturing()) { | 42 if (net_log_.IsCapturing()) { |
45 net_log_.AddEvent(NetLogEventType::HTTP2_SESSION_RECV_INVALID_HEADER, | 43 net_log_.AddEvent(NetLogEventType::HTTP2_SESSION_RECV_INVALID_HEADER, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 SpdyStringPiece("\0", 1).AppendToString(&s); | 100 SpdyStringPiece("\0", 1).AppendToString(&s); |
103 } | 101 } |
104 value.AppendToString(&s); | 102 value.AppendToString(&s); |
105 headers_[key] = s; | 103 headers_[key] = s; |
106 } | 104 } |
107 return true; | 105 return true; |
108 } | 106 } |
109 | 107 |
110 | 108 |
111 } // namespace net | 109 } // namespace net |
OLD | NEW |