Chromium Code Reviews| Index: net/spdy/spdy_stream.cc |
| diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc |
| index a78a78f790f4bfda1fe43cbb2704fd4d118894b3..9da75bc6a682f92e8cc1c9fbbee5319bebec5b09 100644 |
| --- a/net/spdy/spdy_stream.cc |
| +++ b/net/spdy/spdy_stream.cc |
| @@ -57,6 +57,8 @@ bool ContainsUppercaseAscii(const std::string& str) { |
| } // namespace |
| +void SpdyStream::Delegate::OnTrailers(const SpdyHeaderBlock& trailers) {} |
| + |
| // A wrapper around a stream that calls into ProduceSynStreamFrame(). |
| class SpdyStream::SynStreamBufferProducer : public SpdyBufferProducer { |
| public: |
| @@ -440,12 +442,18 @@ int SpdyStream::OnInitialResponseHeadersReceived( |
| int SpdyStream::OnAdditionalResponseHeadersReceived( |
| const SpdyHeaderBlock& additional_response_headers) { |
| if (type_ == SPDY_REQUEST_RESPONSE_STREAM) { |
| - session_->ResetStream( |
| - stream_id_, RST_STREAM_PROTOCOL_ERROR, |
| - "Additional headers received for request/response stream"); |
| - return ERR_SPDY_PROTOCOL_ERROR; |
| - } else if (type_ == SPDY_PUSH_STREAM && |
| - response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) { |
| + if (response_headers_status_ != RESPONSE_HEADERS_ARE_COMPLETE) { |
| + session_->ResetStream( |
| + stream_id_, RST_STREAM_PROTOCOL_ERROR, |
| + "Additional headers received for request/response stream"); |
| + return ERR_SPDY_PROTOCOL_ERROR; |
| + } |
| + response_headers_status_ = TRAILERS_RECEIVED; |
| + delegate_->OnTrailers(additional_response_headers); |
| + return OK; |
| + } |
| + if (type_ == SPDY_PUSH_STREAM && |
| + response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) { |
| session_->ResetStream( |
| stream_id_, RST_STREAM_PROTOCOL_ERROR, |
| "Additional headers received for push stream"); |
| @@ -484,6 +492,12 @@ void SpdyStream::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { |
| return; |
| } |
| + if (response_headers_status_ == TRAILERS_RECEIVED && buffer) { |
| + session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR, |
| + "Data received after trailers"); |
|
Ryan Hamilton
2015/08/10 17:23:25
Should this only be checked for SPDY_REQUEST_RESPO
xunjieli
2015/08/10 20:31:07
I added a DCHECK. Since TRAILERS_RECEIVED is only
|
| + return; |
| + } |
| + |
| // If we have response headers but the delegate has indicated that |
| // it's still incomplete, then that's a protocol error. |
| if (response_headers_status_ == RESPONSE_HEADERS_ARE_INCOMPLETE) { |