| 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/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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 DLOG(ERROR) << "Trailers are malformed: " << id(); | 286 DLOG(ERROR) << "Trailers are malformed: " << id(); |
| 287 session()->connection()->CloseConnection( | 287 session()->connection()->CloseConnection( |
| 288 QUIC_INVALID_HEADERS_STREAM_DATA, "Trailers are malformed", | 288 QUIC_INVALID_HEADERS_STREAM_DATA, "Trailers are malformed", |
| 289 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 289 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
| 290 return; | 290 return; |
| 291 } | 291 } |
| 292 | 292 |
| 293 // The data on this stream ends at |final_byte_offset|. | 293 // The data on this stream ends at |final_byte_offset|. |
| 294 DVLOG(1) << "Stream ends at byte offset: " << final_byte_offset | 294 DVLOG(1) << "Stream ends at byte offset: " << final_byte_offset |
| 295 << " currently read: " << stream_bytes_read(); | 295 << " currently read: " << stream_bytes_read(); |
| 296 | 296 trailers_decompressed_ = true; |
| 297 OnStreamFrame(QuicStreamFrame(id(), fin, final_byte_offset, StringPiece())); | 297 OnStreamFrame(QuicStreamFrame(id(), fin, final_byte_offset, StringPiece())); |
| 298 trailers_decompressed_ = true; | |
| 299 } | 298 } |
| 300 | 299 |
| 301 void QuicSpdyStream::OnTrailingHeadersComplete( | 300 void QuicSpdyStream::OnTrailingHeadersComplete( |
| 302 bool fin, | 301 bool fin, |
| 303 size_t /*frame_len*/, | 302 size_t /*frame_len*/, |
| 304 const QuicHeaderList& header_list) { | 303 const QuicHeaderList& header_list) { |
| 305 DCHECK(!trailers_decompressed_); | 304 DCHECK(!trailers_decompressed_); |
| 306 if (fin_received()) { | 305 if (fin_received()) { |
| 307 DLOG(ERROR) << "Received Trailers after FIN, on stream: " << id(); | 306 DLOG(ERROR) << "Received Trailers after FIN, on stream: " << id(); |
| 308 session()->connection()->CloseConnection( | 307 session()->connection()->CloseConnection( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 320 | 319 |
| 321 size_t final_byte_offset = 0; | 320 size_t final_byte_offset = 0; |
| 322 if (!SpdyUtils::CopyAndValidateTrailers(header_list, &final_byte_offset, | 321 if (!SpdyUtils::CopyAndValidateTrailers(header_list, &final_byte_offset, |
| 323 &received_trailers_)) { | 322 &received_trailers_)) { |
| 324 DLOG(ERROR) << "Trailers are malformed: " << id(); | 323 DLOG(ERROR) << "Trailers are malformed: " << id(); |
| 325 session()->connection()->CloseConnection( | 324 session()->connection()->CloseConnection( |
| 326 QUIC_INVALID_HEADERS_STREAM_DATA, "Trailers are malformed", | 325 QUIC_INVALID_HEADERS_STREAM_DATA, "Trailers are malformed", |
| 327 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 326 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
| 328 return; | 327 return; |
| 329 } | 328 } |
| 329 trailers_decompressed_ = true; |
| 330 OnStreamFrame(QuicStreamFrame(id(), fin, final_byte_offset, StringPiece())); | 330 OnStreamFrame(QuicStreamFrame(id(), fin, final_byte_offset, StringPiece())); |
| 331 trailers_decompressed_ = true; | |
| 332 } | 331 } |
| 333 | 332 |
| 334 void QuicSpdyStream::OnStreamReset(const QuicRstStreamFrame& frame) { | 333 void QuicSpdyStream::OnStreamReset(const QuicRstStreamFrame& frame) { |
| 335 if (frame.error_code != QUIC_STREAM_NO_ERROR) { | 334 if (frame.error_code != QUIC_STREAM_NO_ERROR) { |
| 336 ReliableQuicStream::OnStreamReset(frame); | 335 ReliableQuicStream::OnStreamReset(frame); |
| 337 return; | 336 return; |
| 338 } | 337 } |
| 339 DVLOG(1) << "Received QUIC_STREAM_NO_ERROR, not discarding response"; | 338 DVLOG(1) << "Received QUIC_STREAM_NO_ERROR, not discarding response"; |
| 340 set_rst_received(true); | 339 set_rst_received(true); |
| 341 MaybeIncreaseHighestReceivedOffset(frame.byte_offset); | 340 MaybeIncreaseHighestReceivedOffset(frame.byte_offset); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 if (spdy_session_->headers_stream() != nullptr && | 417 if (spdy_session_->headers_stream() != nullptr && |
| 419 spdy_session_->force_hol_blocking()) { | 418 spdy_session_->force_hol_blocking()) { |
| 420 return spdy_session_->headers_stream()->WritevStreamData( | 419 return spdy_session_->headers_stream()->WritevStreamData( |
| 421 id(), iov, offset, fin, ack_notifier_delegate); | 420 id(), iov, offset, fin, ack_notifier_delegate); |
| 422 } | 421 } |
| 423 return ReliableQuicStream::WritevDataInner(iov, offset, fin, | 422 return ReliableQuicStream::WritevDataInner(iov, offset, fin, |
| 424 ack_notifier_delegate); | 423 ack_notifier_delegate); |
| 425 } | 424 } |
| 426 | 425 |
| 427 } // namespace net | 426 } // namespace net |
| OLD | NEW |