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

Side by Side Diff: net/quic/core/quic_spdy_stream.cc

Issue 2430513002: Limit QUIC uncompressed header size per stream to 16K, by default. Protected by FLAGS_quic_limit_un… (Closed)
Patch Set: Created 4 years, 2 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/quic/core/quic_spdy_stream.h ('k') | net/quic/core/quic_spdy_stream_test.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 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/core/quic_spdy_stream.h" 5 #include "net/quic/core/quic_spdy_stream.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 if (!headers_decompressed_) { 198 if (!headers_decompressed_) {
199 OnInitialHeadersComplete(fin, frame_len); 199 OnInitialHeadersComplete(fin, frame_len);
200 } else { 200 } else {
201 OnTrailingHeadersComplete(fin, frame_len); 201 OnTrailingHeadersComplete(fin, frame_len);
202 } 202 }
203 } 203 }
204 204
205 void QuicSpdyStream::OnStreamHeaderList(bool fin, 205 void QuicSpdyStream::OnStreamHeaderList(bool fin,
206 size_t frame_len, 206 size_t frame_len,
207 const QuicHeaderList& header_list) { 207 const QuicHeaderList& header_list) {
208 // The headers list avoid infinite buffering by clearing the headers list
209 // if the current headers are too large. So if the list is empty here
210 // then the headers list must have been too large, and the stream should
211 // be reset.
212 if (FLAGS_quic_limit_uncompressed_headers && header_list.empty()) {
213 OnHeadersTooLarge();
214 if (IsDoneReading()) {
215 return;
216 }
217 }
208 if (!headers_decompressed_) { 218 if (!headers_decompressed_) {
209 OnInitialHeadersComplete(fin, frame_len, header_list); 219 OnInitialHeadersComplete(fin, frame_len, header_list);
210 } else { 220 } else {
211 OnTrailingHeadersComplete(fin, frame_len, header_list); 221 OnTrailingHeadersComplete(fin, frame_len, header_list);
212 } 222 }
213 } 223 }
214 224
225 void QuicSpdyStream::OnHeadersTooLarge() {
226 Reset(QUIC_HEADERS_TOO_LARGE);
227 }
228
215 void QuicSpdyStream::OnInitialHeadersComplete(bool fin, size_t /*frame_len*/) { 229 void QuicSpdyStream::OnInitialHeadersComplete(bool fin, size_t /*frame_len*/) {
216 headers_decompressed_ = true; 230 headers_decompressed_ = true;
217 if (fin) { 231 if (fin) {
218 OnStreamFrame(QuicStreamFrame(id(), fin, 0, StringPiece())); 232 OnStreamFrame(QuicStreamFrame(id(), fin, 0, StringPiece()));
219 } 233 }
220 if (FinishedReadingHeaders()) { 234 if (FinishedReadingHeaders()) {
221 sequencer()->SetUnblocked(); 235 sequencer()->SetUnblocked();
222 } 236 }
223 } 237 }
224 238
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 if (spdy_session_->headers_stream() != nullptr && 432 if (spdy_session_->headers_stream() != nullptr &&
419 spdy_session_->force_hol_blocking()) { 433 spdy_session_->force_hol_blocking()) {
420 return spdy_session_->headers_stream()->WritevStreamData( 434 return spdy_session_->headers_stream()->WritevStreamData(
421 id(), iov, offset, fin, ack_notifier_delegate); 435 id(), iov, offset, fin, ack_notifier_delegate);
422 } 436 }
423 return ReliableQuicStream::WritevDataInner(iov, offset, fin, 437 return ReliableQuicStream::WritevDataInner(iov, offset, fin,
424 ack_notifier_delegate); 438 ack_notifier_delegate);
425 } 439 }
426 440
427 } // namespace net 441 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_spdy_stream.h ('k') | net/quic/core/quic_spdy_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698