| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 int QuicHttpStream::SendRequest(const HttpRequestHeaders& request_headers, | 103 int QuicHttpStream::SendRequest(const HttpRequestHeaders& request_headers, |
| 104 HttpResponseInfo* response, | 104 HttpResponseInfo* response, |
| 105 const CompletionCallback& callback) { | 105 const CompletionCallback& callback) { |
| 106 CHECK(!request_body_stream_); | 106 CHECK(!request_body_stream_); |
| 107 CHECK(!response_info_); | 107 CHECK(!response_info_); |
| 108 CHECK(!callback.is_null()); | 108 CHECK(!callback.is_null()); |
| 109 CHECK(response); | 109 CHECK(response); |
| 110 | 110 |
| 111 if (!stream_) { | 111 // TODO(rch): remove this once we figure out why channel ID is not being |
| 112 // sent when it should be. |
| 113 HostPortPair origin = HostPortPair::FromURL(request_info_->url); |
| 114 if (origin.Equals(HostPortPair("accounts.google.com", 443))) { |
| 115 SSLInfo ssl_info; |
| 116 bool secure_session = |
| 117 session_->GetSSLInfo(&ssl_info) && ssl_info.cert.get(); |
| 118 DCHECK(secure_session); |
| 119 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.CookieSentToAccountsOverChannelId", |
| 120 ssl_info.channel_id_sent); |
| 121 } |
| 122 if (!stream_) { |
| 112 return ERR_CONNECTION_CLOSED; | 123 return ERR_CONNECTION_CLOSED; |
| 113 } | 124 } |
| 114 | 125 |
| 115 QuicPriority priority = ConvertRequestPriorityToQuicPriority(priority_); | 126 QuicPriority priority = ConvertRequestPriorityToQuicPriority(priority_); |
| 116 stream_->set_priority(priority); | 127 stream_->set_priority(priority); |
| 117 // Store the serialized request headers. | 128 // Store the serialized request headers. |
| 118 CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers, | 129 CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers, |
| 119 SPDY3, /*direct=*/true, &request_headers_); | 130 SPDY3, /*direct=*/true, &request_headers_); |
| 120 | 131 |
| 121 // Store the request body. | 132 // Store the request body. |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 | 567 |
| 557 void QuicHttpStream::BufferResponseBody(const char* data, int length) { | 568 void QuicHttpStream::BufferResponseBody(const char* data, int length) { |
| 558 if (length == 0) | 569 if (length == 0) |
| 559 return; | 570 return; |
| 560 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); | 571 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); |
| 561 memcpy(io_buffer->data(), data, length); | 572 memcpy(io_buffer->data(), data, length); |
| 562 response_body_.push_back(make_scoped_refptr(io_buffer)); | 573 response_body_.push_back(make_scoped_refptr(io_buffer)); |
| 563 } | 574 } |
| 564 | 575 |
| 565 } // namespace net | 576 } // namespace net |
| OLD | NEW |