| 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_macros.h" | 8 #include "base/metrics/histogram_macros.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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 const CompletionCallback& callback) { | 59 const CompletionCallback& callback) { |
| 60 DCHECK(!stream_); | 60 DCHECK(!stream_); |
| 61 if (!session_) | 61 if (!session_) |
| 62 return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED : | 62 return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED : |
| 63 ERR_QUIC_HANDSHAKE_FAILED; | 63 ERR_QUIC_HANDSHAKE_FAILED; |
| 64 | 64 |
| 65 stream_net_log.AddEvent( | 65 stream_net_log.AddEvent( |
| 66 NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_QUIC_SESSION, | 66 NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_QUIC_SESSION, |
| 67 session_->net_log().source().ToEventParametersCallback()); | 67 session_->net_log().source().ToEventParametersCallback()); |
| 68 | 68 |
| 69 if (request_info->url.SchemeIsCryptographic()) { | |
| 70 SSLInfo ssl_info; | |
| 71 bool secure_session = | |
| 72 session_->GetSSLInfo(&ssl_info) && ssl_info.cert.get(); | |
| 73 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.SecureResourceSecureSession", | |
| 74 secure_session); | |
| 75 if (!secure_session) | |
| 76 return ERR_REQUEST_FOR_SECURE_RESOURCE_OVER_INSECURE_QUIC; | |
| 77 } | |
| 78 | |
| 79 stream_net_log_ = stream_net_log; | 69 stream_net_log_ = stream_net_log; |
| 80 request_info_ = request_info; | 70 request_info_ = request_info; |
| 81 request_time_ = base::Time::Now(); | 71 request_time_ = base::Time::Now(); |
| 82 priority_ = priority; | 72 priority_ = priority; |
| 83 | 73 |
| 84 int rv = stream_request_.StartRequest( | 74 int rv = stream_request_.StartRequest( |
| 85 session_, &stream_, base::Bind(&QuicHttpStream::OnStreamReady, | 75 session_, &stream_, base::Bind(&QuicHttpStream::OnStreamReady, |
| 86 weak_factory_.GetWeakPtr())); | 76 weak_factory_.GetWeakPtr())); |
| 87 if (rv == ERR_IO_PENDING) { | 77 if (rv == ERR_IO_PENDING) { |
| 88 callback_ = callback; | 78 callback_ = callback; |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 553 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
| 564 stream_ = nullptr; | 554 stream_ = nullptr; |
| 565 | 555 |
| 566 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 556 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
| 567 // read. | 557 // read. |
| 568 if (request_body_stream_) | 558 if (request_body_stream_) |
| 569 request_body_stream_->Reset(); | 559 request_body_stream_->Reset(); |
| 570 } | 560 } |
| 571 | 561 |
| 572 } // namespace net | 562 } // namespace net |
| OLD | NEW |