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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 void SpdyStream::LogStreamError(int status, const std::string& description) { | 640 void SpdyStream::LogStreamError(int status, const std::string& description) { |
641 net_log_.AddEvent(NetLogEventType::HTTP2_STREAM_ERROR, | 641 net_log_.AddEvent(NetLogEventType::HTTP2_STREAM_ERROR, |
642 base::Bind(&NetLogSpdyStreamErrorCallback, stream_id_, | 642 base::Bind(&NetLogSpdyStreamErrorCallback, stream_id_, |
643 status, &description)); | 643 status, &description)); |
644 } | 644 } |
645 | 645 |
646 void SpdyStream::OnClose(int status) { | 646 void SpdyStream::OnClose(int status) { |
647 // In most cases, the stream should already be CLOSED. The exception is when a | 647 // In most cases, the stream should already be CLOSED. The exception is when a |
648 // SpdySession is shutting down while the stream is in an intermediate state. | 648 // SpdySession is shutting down while the stream is in an intermediate state. |
649 io_state_ = STATE_CLOSED; | 649 io_state_ = STATE_CLOSED; |
| 650 if (status == ERR_SPDY_RST_STREAM_NO_ERROR_RECEIVED) { |
| 651 if (response_headers_status_ == RESPONSE_HEADERS_ARE_INCOMPLETE) { |
| 652 status = ERR_SPDY_PROTOCOL_ERROR; |
| 653 } else { |
| 654 status = OK; |
| 655 } |
| 656 } |
650 response_status_ = status; | 657 response_status_ = status; |
651 Delegate* delegate = delegate_; | 658 Delegate* delegate = delegate_; |
652 delegate_ = NULL; | 659 delegate_ = NULL; |
653 if (delegate) | 660 if (delegate) |
654 delegate->OnClose(status); | 661 delegate->OnClose(status); |
655 // Unset |stream_id_| last so that the delegate can look it up. | 662 // Unset |stream_id_| last so that the delegate can look it up. |
656 stream_id_ = 0; | 663 stream_id_ = 0; |
657 } | 664 } |
658 | 665 |
659 void SpdyStream::Cancel() { | 666 void SpdyStream::Cancel() { |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 944 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
938 state); | 945 state); |
939 break; | 946 break; |
940 } | 947 } |
941 return description; | 948 return description; |
942 } | 949 } |
943 | 950 |
944 #undef STATE_CASE | 951 #undef STATE_CASE |
945 | 952 |
946 } // namespace net | 953 } // namespace net |
OLD | NEW |