| Index: net/spdy/spdy_stream.cc
|
| diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
|
| index a78a78f790f4bfda1fe43cbb2704fd4d118894b3..812d5205bb5d56ee7147711afd6a3c831e92f9ff 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,14 @@ void SpdyStream::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) {
|
| return;
|
| }
|
|
|
| + if (response_headers_status_ == TRAILERS_RECEIVED && buffer) {
|
| + // TRAILERS_RECEIVED is only used in SPDY_REQUEST_RESPONSE_STREAM.
|
| + DCHECK_EQ(type_, SPDY_REQUEST_RESPONSE_STREAM);
|
| + session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR,
|
| + "Data received after trailers");
|
| + 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) {
|
|
|