| 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/tools/quic/quic_spdy_client_stream.h" | 5 #include "net/tools/quic/quic_spdy_client_stream.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "net/quic/core/quic_alarm.h" | 9 #include "net/quic/core/quic_alarm.h" |
| 10 #include "net/quic/core/quic_client_promised_info.h" | 10 #include "net/quic/core/quic_client_promised_info.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 : QuicSpdyStream(id, session), | 22 : QuicSpdyStream(id, session), |
| 23 content_length_(-1), | 23 content_length_(-1), |
| 24 response_code_(0), | 24 response_code_(0), |
| 25 header_bytes_read_(0), | 25 header_bytes_read_(0), |
| 26 header_bytes_written_(0), | 26 header_bytes_written_(0), |
| 27 session_(session), | 27 session_(session), |
| 28 has_preliminary_headers_(false) {} | 28 has_preliminary_headers_(false) {} |
| 29 | 29 |
| 30 QuicSpdyClientStream::~QuicSpdyClientStream() {} | 30 QuicSpdyClientStream::~QuicSpdyClientStream() {} |
| 31 | 31 |
| 32 void QuicSpdyClientStream::OnStreamFrame(const QuicStreamFrame& frame) { | |
| 33 if (!allow_bidirectional_data() && !write_side_closed()) { | |
| 34 QUIC_DLOG(INFO) << "Got a response before the request was complete. " | |
| 35 << "Aborting request."; | |
| 36 CloseWriteSide(); | |
| 37 } | |
| 38 QuicSpdyStream::OnStreamFrame(frame); | |
| 39 } | |
| 40 | |
| 41 void QuicSpdyClientStream::OnInitialHeadersComplete( | 32 void QuicSpdyClientStream::OnInitialHeadersComplete( |
| 42 bool fin, | 33 bool fin, |
| 43 size_t frame_len, | 34 size_t frame_len, |
| 44 const QuicHeaderList& header_list) { | 35 const QuicHeaderList& header_list) { |
| 45 QuicSpdyStream::OnInitialHeadersComplete(fin, frame_len, header_list); | 36 QuicSpdyStream::OnInitialHeadersComplete(fin, frame_len, header_list); |
| 46 | 37 |
| 47 DCHECK(headers_decompressed()); | 38 DCHECK(headers_decompressed()); |
| 48 header_bytes_read_ += frame_len; | 39 header_bytes_read_ += frame_len; |
| 49 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &content_length_, | 40 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &content_length_, |
| 50 &response_headers_)) { | 41 &response_headers_)) { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 bytes_sent += header_bytes_written_; | 139 bytes_sent += header_bytes_written_; |
| 149 | 140 |
| 150 if (!body.empty()) { | 141 if (!body.empty()) { |
| 151 WriteOrBufferData(body, fin, nullptr); | 142 WriteOrBufferData(body, fin, nullptr); |
| 152 } | 143 } |
| 153 | 144 |
| 154 return bytes_sent; | 145 return bytes_sent; |
| 155 } | 146 } |
| 156 | 147 |
| 157 } // namespace net | 148 } // namespace net |
| OLD | NEW |