Upstream version 10.38.208.0
[platform/framework/web/crosswalk.git] / src / net / quic / quic_http_stream.cc
index 36eac6a..3ddfa06 100644 (file)
@@ -102,12 +102,15 @@ void QuicHttpStream::OnStreamReady(int rv) {
 int QuicHttpStream::SendRequest(const HttpRequestHeaders& request_headers,
                                 HttpResponseInfo* response,
                                 const CompletionCallback& callback) {
-  CHECK(stream_);
   CHECK(!request_body_stream_);
   CHECK(!response_info_);
   CHECK(!callback.is_null());
   CHECK(response);
 
+   if (!stream_) {
+    return ERR_CONNECTION_CLOSED;
+  }
+
   QuicPriority priority = ConvertRequestPriorityToQuicPriority(priority_);
   stream_->set_priority(priority);
   // Store the serialized request headers.
@@ -215,6 +218,8 @@ void QuicHttpStream::Close(bool not_reusable) {
     stream_->SetDelegate(NULL);
     stream_->Reset(QUIC_STREAM_CANCELLED);
     stream_ = NULL;
+    response_status_ = was_handshake_confirmed_ ?
+        ERR_CONNECTION_CLOSED : ERR_QUIC_HANDSHAKE_FAILED;
   }
 }
 
@@ -352,6 +357,7 @@ void QuicHttpStream::OnCryptoHandshakeConfirmed() {
 }
 
 void QuicHttpStream::OnSessionClosed(int error) {
+  Close(false);
   session_error_ = error;
   session_.reset();
 }