OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/quic/quic_headers_stream.h" | 5 #include "net/quic/quic_headers_stream.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| 11 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
12 #include "net/quic/quic_bug_tracker.h" | 13 #include "net/quic/quic_bug_tracker.h" |
13 #include "net/quic/quic_flags.h" | 14 #include "net/quic/quic_flags.h" |
14 #include "net/quic/quic_header_list.h" | 15 #include "net/quic/quic_header_list.h" |
15 #include "net/quic/quic_spdy_session.h" | 16 #include "net/quic/quic_spdy_session.h" |
16 #include "net/quic/quic_time.h" | 17 #include "net/quic/quic_time.h" |
17 #include "net/spdy/spdy_protocol.h" | 18 #include "net/spdy/spdy_protocol.h" |
18 | 19 |
19 using base::StringPiece; | 20 using base::StringPiece; |
20 using net::HTTP2; | 21 using net::HTTP2; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 bool fin) override { | 135 bool fin) override { |
135 CloseConnection("SPDY DATA frame received."); | 136 CloseConnection("SPDY DATA frame received."); |
136 } | 137 } |
137 | 138 |
138 void OnRstStream(SpdyStreamId stream_id, | 139 void OnRstStream(SpdyStreamId stream_id, |
139 SpdyRstStreamStatus status) override { | 140 SpdyRstStreamStatus status) override { |
140 CloseConnection("SPDY RST_STREAM frame received."); | 141 CloseConnection("SPDY RST_STREAM frame received."); |
141 } | 142 } |
142 | 143 |
143 void OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) override { | 144 void OnSetting(SpdySettingsIds id, uint8_t flags, uint32_t value) override { |
144 CloseConnection("SPDY SETTINGS frame received."); | 145 if (!FLAGS_quic_respect_http2_settings_frame) { |
| 146 CloseConnection("SPDY SETTINGS frame received."); |
| 147 return; |
| 148 } |
| 149 switch (id) { |
| 150 case SETTINGS_HEADER_TABLE_SIZE: |
| 151 stream_->UpdateHeaderEncoderTableSize(value); |
| 152 break; |
| 153 // TODO(fayang): Need to support SETTINGS_MAX_HEADER_LIST_SIZE when |
| 154 // clients are actually sending it. |
| 155 default: |
| 156 CloseConnection( |
| 157 "Unsupported field of HTTP/2 SETTINGS frame: " + base::IntToString(i
d)); |
| 158 } |
145 } | 159 } |
146 | 160 |
147 void OnSettingsAck() override { | 161 void OnSettingsAck() override { |
148 CloseConnection("SPDY SETTINGS frame received."); | 162 if (!FLAGS_quic_respect_http2_settings_frame) { |
| 163 CloseConnection("SPDY SETTINGS frame received."); |
| 164 } |
149 } | 165 } |
150 | 166 |
151 void OnSettingsEnd() override { | 167 void OnSettingsEnd() override { |
152 CloseConnection("SPDY SETTINGS frame received."); | 168 if (!FLAGS_quic_respect_http2_settings_frame) { |
| 169 CloseConnection("SPDY SETTINGS frame received."); |
| 170 } |
153 } | 171 } |
154 | 172 |
155 void OnPing(SpdyPingId unique_id, bool is_ack) override { | 173 void OnPing(SpdyPingId unique_id, bool is_ack) override { |
156 CloseConnection("SPDY PING frame received."); | 174 CloseConnection("SPDY PING frame received."); |
157 } | 175 } |
158 | 176 |
159 void OnGoAway(SpdyStreamId last_accepted_stream_id, | 177 void OnGoAway(SpdyStreamId last_accepted_stream_id, |
160 SpdyGoAwayStatus status) override { | 178 SpdyGoAwayStatus status) override { |
161 CloseConnection("SPDY GOAWAY frame received."); | 179 CloseConnection("SPDY GOAWAY frame received."); |
162 } | 180 } |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 session()->connection()->helper()->GetClock(), std::move(visitor)))); | 495 session()->connection()->helper()->GetClock(), std::move(visitor)))); |
478 } | 496 } |
479 | 497 |
480 void QuicHeadersStream::SetHpackDecoderDebugVisitor( | 498 void QuicHeadersStream::SetHpackDecoderDebugVisitor( |
481 std::unique_ptr<HpackDebugVisitor> visitor) { | 499 std::unique_ptr<HpackDebugVisitor> visitor) { |
482 spdy_framer_.SetDecoderHeaderTableDebugVisitor( | 500 spdy_framer_.SetDecoderHeaderTableDebugVisitor( |
483 std::unique_ptr<HeaderTableDebugVisitor>(new HeaderTableDebugVisitor( | 501 std::unique_ptr<HeaderTableDebugVisitor>(new HeaderTableDebugVisitor( |
484 session()->connection()->helper()->GetClock(), std::move(visitor)))); | 502 session()->connection()->helper()->GetClock(), std::move(visitor)))); |
485 } | 503 } |
486 | 504 |
| 505 void QuicHeadersStream::UpdateHeaderEncoderTableSize(uint32_t value) { |
| 506 spdy_framer_.UpdateHeaderEncoderTableSize(value); |
| 507 } |
| 508 |
487 } // namespace net | 509 } // namespace net |
OLD | NEW |