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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 if (response_headers_status_ != RESPONSE_HEADERS_ARE_COMPLETE) { | 446 if (response_headers_status_ != RESPONSE_HEADERS_ARE_COMPLETE) { |
447 session_->ResetStream( | 447 session_->ResetStream( |
448 stream_id_, RST_STREAM_PROTOCOL_ERROR, | 448 stream_id_, RST_STREAM_PROTOCOL_ERROR, |
449 "Additional headers received for request/response stream"); | 449 "Additional headers received for request/response stream"); |
450 return ERR_SPDY_PROTOCOL_ERROR; | 450 return ERR_SPDY_PROTOCOL_ERROR; |
451 } | 451 } |
452 response_headers_status_ = TRAILERS_RECEIVED; | 452 response_headers_status_ = TRAILERS_RECEIVED; |
453 delegate_->OnTrailers(additional_response_headers); | 453 delegate_->OnTrailers(additional_response_headers); |
454 return OK; | 454 return OK; |
455 } | 455 } |
| 456 if (type_ == SPDY_BIDIRECTIONAL_STREAM) { |
| 457 DCHECK_EQ(RESPONSE_HEADERS_ARE_COMPLETE, response_headers_status_); |
| 458 response_headers_status_ = TRAILERS_RECEIVED; |
| 459 delegate_->OnTrailers(additional_response_headers); |
| 460 return OK; |
| 461 } |
456 if (type_ == SPDY_PUSH_STREAM && | 462 if (type_ == SPDY_PUSH_STREAM && |
457 response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) { | 463 response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) { |
458 session_->ResetStream( | 464 session_->ResetStream( |
459 stream_id_, RST_STREAM_PROTOCOL_ERROR, | 465 stream_id_, RST_STREAM_PROTOCOL_ERROR, |
460 "Additional headers received for push stream"); | 466 "Additional headers received for push stream"); |
461 return ERR_SPDY_PROTOCOL_ERROR; | 467 return ERR_SPDY_PROTOCOL_ERROR; |
462 } | 468 } |
463 return MergeWithResponseHeaders(additional_response_headers); | 469 return MergeWithResponseHeaders(additional_response_headers); |
464 } | 470 } |
465 | 471 |
(...skipping 21 matching lines...) Expand all Loading... |
487 pending_recv_data_.push_back(std::move(buffer)); | 493 pending_recv_data_.push_back(std::move(buffer)); |
488 } else { | 494 } else { |
489 pending_recv_data_.push_back(NULL); | 495 pending_recv_data_.push_back(NULL); |
490 // Note: we leave the stream open in the session until the stream | 496 // Note: we leave the stream open in the session until the stream |
491 // is claimed. | 497 // is claimed. |
492 } | 498 } |
493 return; | 499 return; |
494 } | 500 } |
495 | 501 |
496 if (response_headers_status_ == TRAILERS_RECEIVED && buffer) { | 502 if (response_headers_status_ == TRAILERS_RECEIVED && buffer) { |
497 // TRAILERS_RECEIVED is only used in SPDY_REQUEST_RESPONSE_STREAM. | 503 // TRAILERS_RECEIVED is only used in SPDY_REQUEST_RESPONSE_STREAM and |
498 DCHECK_EQ(type_, SPDY_REQUEST_RESPONSE_STREAM); | 504 // SPDY_BIDIRECTIONAL_STREAM. |
| 505 DCHECK(type_ == SPDY_REQUEST_RESPONSE_STREAM || |
| 506 type_ == SPDY_BIDIRECTIONAL_STREAM); |
499 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR, | 507 session_->ResetStream(stream_id_, RST_STREAM_PROTOCOL_ERROR, |
500 "Data received after trailers"); | 508 "Data received after trailers"); |
501 return; | 509 return; |
502 } | 510 } |
503 | 511 |
504 // If we have response headers but the delegate has indicated that | 512 // If we have response headers but the delegate has indicated that |
505 // it's still incomplete, then that's a protocol error. | 513 // it's still incomplete, then that's a protocol error. |
506 if (response_headers_status_ == RESPONSE_HEADERS_ARE_INCOMPLETE) { | 514 if (response_headers_status_ == RESPONSE_HEADERS_ARE_INCOMPLETE) { |
507 LogStreamError(ERR_SPDY_PROTOCOL_ERROR, | 515 LogStreamError(ERR_SPDY_PROTOCOL_ERROR, |
508 "Data received with incomplete headers."); | 516 "Data received with incomplete headers."); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 954 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
947 state); | 955 state); |
948 break; | 956 break; |
949 } | 957 } |
950 return description; | 958 return description; |
951 } | 959 } |
952 | 960 |
953 #undef STATE_CASE | 961 #undef STATE_CASE |
954 | 962 |
955 } // namespace net | 963 } // namespace net |
OLD | NEW |