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/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info, | 53 int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info, |
54 RequestPriority priority, | 54 RequestPriority priority, |
55 const BoundNetLog& stream_net_log, | 55 const BoundNetLog& stream_net_log, |
56 const CompletionCallback& callback) { | 56 const CompletionCallback& callback) { |
57 DCHECK(!stream_); | 57 DCHECK(!stream_); |
58 if (!session_) | 58 if (!session_) |
59 return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED : | 59 return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED : |
60 ERR_QUIC_HANDSHAKE_FAILED; | 60 ERR_QUIC_HANDSHAKE_FAILED; |
61 | 61 |
| 62 if (request_info->url.SchemeIsSecure()) { |
| 63 SSLInfo ssl_info; |
| 64 if (!session_->GetSSLInfo(&ssl_info) || !ssl_info.cert) { |
| 65 return ERR_REQUEST_FOR_SECURE_RESOURCE_OVER_INSECURE_QUIC; |
| 66 } |
| 67 } |
| 68 |
62 stream_net_log_ = stream_net_log; | 69 stream_net_log_ = stream_net_log; |
63 request_info_ = request_info; | 70 request_info_ = request_info; |
64 priority_ = priority; | 71 priority_ = priority; |
65 | 72 |
66 int rv = stream_request_.StartRequest( | 73 int rv = stream_request_.StartRequest( |
67 session_, &stream_, base::Bind(&QuicHttpStream::OnStreamReady, | 74 session_, &stream_, base::Bind(&QuicHttpStream::OnStreamReady, |
68 weak_factory_.GetWeakPtr())); | 75 weak_factory_.GetWeakPtr())); |
69 if (rv == ERR_IO_PENDING) { | 76 if (rv == ERR_IO_PENDING) { |
70 callback_ = callback; | 77 callback_ = callback; |
71 } else if (rv == OK) { | 78 } else if (rv == OK) { |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 | 548 |
542 void QuicHttpStream::BufferResponseBody(const char* data, int length) { | 549 void QuicHttpStream::BufferResponseBody(const char* data, int length) { |
543 if (length == 0) | 550 if (length == 0) |
544 return; | 551 return; |
545 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); | 552 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); |
546 memcpy(io_buffer->data(), data, length); | 553 memcpy(io_buffer->data(), data, length); |
547 response_body_.push_back(make_scoped_refptr(io_buffer)); | 554 response_body_.push_back(make_scoped_refptr(io_buffer)); |
548 } | 555 } |
549 | 556 |
550 } // namespace net | 557 } // namespace net |
OLD | NEW |