| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/spdy/spdy_stream.h" | 5 #include "net/spdy/spdy_stream.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 if (response_headers_status_ != RESPONSE_HEADERS_ARE_COMPLETE) { | 453 if (response_headers_status_ != RESPONSE_HEADERS_ARE_COMPLETE) { |
| 454 session_->ResetStream( | 454 session_->ResetStream( |
| 455 stream_id_, RST_STREAM_PROTOCOL_ERROR, | 455 stream_id_, RST_STREAM_PROTOCOL_ERROR, |
| 456 "Additional headers received for request/response stream"); | 456 "Additional headers received for request/response stream"); |
| 457 return ERR_SPDY_PROTOCOL_ERROR; | 457 return ERR_SPDY_PROTOCOL_ERROR; |
| 458 } | 458 } |
| 459 response_headers_status_ = TRAILERS_RECEIVED; | 459 response_headers_status_ = TRAILERS_RECEIVED; |
| 460 delegate_->OnTrailers(additional_response_headers); | 460 delegate_->OnTrailers(additional_response_headers); |
| 461 return OK; | 461 return OK; |
| 462 } | 462 } |
| 463 if (type_ == SPDY_BIDIRECTIONAL_STREAM) { |
| 464 DCHECK_EQ(RESPONSE_HEADERS_ARE_COMPLETE, response_headers_status_); |
| 465 response_headers_status_ = TRAILERS_RECEIVED; |
| 466 delegate_->OnTrailers(additional_response_headers); |
| 467 return OK; |
| 468 } |
| 463 if (type_ == SPDY_PUSH_STREAM && | 469 if (type_ == SPDY_PUSH_STREAM && |
| 464 response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) { | 470 response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) { |
| 465 session_->ResetStream( | 471 session_->ResetStream( |
| 466 stream_id_, RST_STREAM_PROTOCOL_ERROR, | 472 stream_id_, RST_STREAM_PROTOCOL_ERROR, |
| 467 "Additional headers received for push stream"); | 473 "Additional headers received for push stream"); |
| 468 return ERR_SPDY_PROTOCOL_ERROR; | 474 return ERR_SPDY_PROTOCOL_ERROR; |
| 469 } | 475 } |
| 470 return MergeWithResponseHeaders(additional_response_headers); | 476 return MergeWithResponseHeaders(additional_response_headers); |
| 471 } | 477 } |
| 472 | 478 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 494 pending_recv_data_.push_back(std::move(buffer)); | 500 pending_recv_data_.push_back(std::move(buffer)); |
| 495 } else { | 501 } else { |
| 496 pending_recv_data_.push_back(NULL); | 502 pending_recv_data_.push_back(NULL); |
| 497 // Note: we leave the stream open in the session until the stream | 503 // Note: we leave the stream open in the session until the stream |
| 498 // is claimed. | 504 // is claimed. |
| 499 } | 505 } |
| 500 return; | 506 return; |
| 501 } | 507 } |
| 502 | 508 |
| 503 if (response_headers_status_ == TRAILERS_RECEIVED && buffer) { | 509 if (response_headers_status_ == TRAILERS_RECEIVED && buffer) { |
| 504 // TRAILERS_RECEIVED is only used in SPDY_REQUEST_RESPONSE_STREAM. | 510 // TRAILERS_RECEIVED is only used in SPDY_REQUEST_RESPONSE_STREAM and |
| 505 DCHECK_EQ(type_, SPDY_REQUEST_RESPONSE_STREAM); | 511 // SPDY_BIDIRECTIONAL_STREAM. |
| 512 DCHECK(type_ == SPDY_REQUEST_RESPONSE_STREAM || |
| 513 type_ == SPDY_BIDIRECTIONAL_STREAM); |
| 506 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR, | 514 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR, |
| 507 "Data received after trailers"); | 515 "Data received after trailers"); |
| 508 return; | 516 return; |
| 509 } | 517 } |
| 510 | 518 |
| 511 // If we have response headers but the delegate has indicated that | 519 // If we have response headers but the delegate has indicated that |
| 512 // it's still incomplete, then that's a protocol error. | 520 // it's still incomplete, then that's a protocol error. |
| 513 if (response_headers_status_ == RESPONSE_HEADERS_ARE_INCOMPLETE) { | 521 if (response_headers_status_ == RESPONSE_HEADERS_ARE_INCOMPLETE) { |
| 514 LogStreamError(ERR_SPDY_PROTOCOL_ERROR, | 522 LogStreamError(ERR_SPDY_PROTOCOL_ERROR, |
| 515 "Data received with incomplete headers."); | 523 "Data received with incomplete headers."); |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 961 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
| 954 state); | 962 state); |
| 955 break; | 963 break; |
| 956 } | 964 } |
| 957 return description; | 965 return description; |
| 958 } | 966 } |
| 959 | 967 |
| 960 #undef STATE_CASE | 968 #undef STATE_CASE |
| 961 | 969 |
| 962 } // namespace net | 970 } // namespace net |
| OLD | NEW |