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/quic/quic_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return ERR_IO_PENDING; | 212 return ERR_IO_PENDING; |
213 } | 213 } |
214 | 214 |
215 void QuicHttpStream::Close(bool not_reusable) { | 215 void QuicHttpStream::Close(bool not_reusable) { |
216 // Note: the not_reusable flag has no meaning for SPDY streams. | 216 // Note: the not_reusable flag has no meaning for SPDY streams. |
217 if (stream_) { | 217 if (stream_) { |
218 closed_stream_received_bytes_ = stream_->stream_bytes_read(); | 218 closed_stream_received_bytes_ = stream_->stream_bytes_read(); |
219 stream_->SetDelegate(NULL); | 219 stream_->SetDelegate(NULL); |
220 stream_->Reset(QUIC_STREAM_CANCELLED); | 220 stream_->Reset(QUIC_STREAM_CANCELLED); |
221 stream_ = NULL; | 221 stream_ = NULL; |
| 222 response_status_ = was_handshake_confirmed_ ? |
| 223 ERR_CONNECTION_CLOSED : ERR_QUIC_HANDSHAKE_FAILED; |
222 } | 224 } |
223 } | 225 } |
224 | 226 |
225 HttpStream* QuicHttpStream::RenewStreamForAuth() { | 227 HttpStream* QuicHttpStream::RenewStreamForAuth() { |
226 return NULL; | 228 return NULL; |
227 } | 229 } |
228 | 230 |
229 bool QuicHttpStream::IsResponseBodyComplete() const { | 231 bool QuicHttpStream::IsResponseBodyComplete() const { |
230 return next_state_ == STATE_OPEN && !stream_; | 232 return next_state_ == STATE_OPEN && !stream_; |
231 } | 233 } |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 556 |
555 void QuicHttpStream::BufferResponseBody(const char* data, int length) { | 557 void QuicHttpStream::BufferResponseBody(const char* data, int length) { |
556 if (length == 0) | 558 if (length == 0) |
557 return; | 559 return; |
558 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); | 560 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); |
559 memcpy(io_buffer->data(), data, length); | 561 memcpy(io_buffer->data(), data, length); |
560 response_body_.push_back(make_scoped_refptr(io_buffer)); | 562 response_body_.push_back(make_scoped_refptr(io_buffer)); |
561 } | 563 } |
562 | 564 |
563 } // namespace net | 565 } // namespace net |
OLD | NEW |