| 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_spdy_stream.h" | 5 #include "net/quic/quic_spdy_stream.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "net/quic/quic_spdy_session.h" | 9 #include "net/quic/quic_spdy_session.h" |
| 10 #include "net/quic/quic_utils.h" | 10 #include "net/quic/quic_utils.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 void QuicSpdyStream::OnInitialHeadersComplete(bool fin, size_t /*frame_len*/) { | 184 void QuicSpdyStream::OnInitialHeadersComplete(bool fin, size_t /*frame_len*/) { |
| 185 headers_decompressed_ = true; | 185 headers_decompressed_ = true; |
| 186 if (fin) { | 186 if (fin) { |
| 187 OnStreamFrame(QuicStreamFrame(id(), fin, 0, StringPiece())); | 187 OnStreamFrame(QuicStreamFrame(id(), fin, 0, StringPiece())); |
| 188 } | 188 } |
| 189 if (FinishedReadingHeaders()) { | 189 if (FinishedReadingHeaders()) { |
| 190 sequencer()->SetUnblocked(); | 190 sequencer()->SetUnblocked(); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 void QuicSpdyStream::OnPromiseHeaders(StringPiece headers_data) { |
| 195 headers_data.AppendToString(&decompressed_headers_); |
| 196 } |
| 197 |
| 198 void QuicSpdyStream::OnPromiseHeadersComplete( |
| 199 QuicStreamId /* promised_stream_id */, |
| 200 size_t /* frame_len */) { |
| 201 // To be overridden in QuicSpdyClientStream. Not supported on |
| 202 // server side. |
| 203 session()->CloseConnectionWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, |
| 204 "Promise headers received by server"); |
| 205 return; |
| 206 } |
| 207 |
| 194 void QuicSpdyStream::OnTrailingHeadersComplete(bool fin, size_t /*frame_len*/) { | 208 void QuicSpdyStream::OnTrailingHeadersComplete(bool fin, size_t /*frame_len*/) { |
| 195 DCHECK(!trailers_decompressed_); | 209 DCHECK(!trailers_decompressed_); |
| 196 if (fin_received()) { | 210 if (fin_received()) { |
| 197 DLOG(ERROR) << "Received Trailers after FIN, on stream: " << id(); | 211 DLOG(ERROR) << "Received Trailers after FIN, on stream: " << id(); |
| 198 session()->CloseConnectionWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, | 212 session()->CloseConnectionWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, |
| 199 "Trailers after fin"); | 213 "Trailers after fin"); |
| 200 return; | 214 return; |
| 201 } | 215 } |
| 202 if (!fin) { | 216 if (!fin) { |
| 203 DLOG(ERROR) << "Trailers must have FIN set, on stream: " << id(); | 217 DLOG(ERROR) << "Trailers must have FIN set, on stream: " << id(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 if (!FLAGS_quic_supports_trailers) { | 255 if (!FLAGS_quic_supports_trailers) { |
| 242 return true; | 256 return true; |
| 243 } | 257 } |
| 244 // If no further trailing headers are expected, and the decompressed trailers | 258 // If no further trailing headers are expected, and the decompressed trailers |
| 245 // (if any) have been consumed, then reading of trailers is finished. | 259 // (if any) have been consumed, then reading of trailers is finished. |
| 246 bool no_more_trailers = fin_received() || trailers_decompressed_; | 260 bool no_more_trailers = fin_received() || trailers_decompressed_; |
| 247 return no_more_trailers && decompressed_trailers_.empty(); | 261 return no_more_trailers && decompressed_trailers_.empty(); |
| 248 } | 262 } |
| 249 | 263 |
| 250 } // namespace net | 264 } // namespace net |
| OLD | NEW |