| 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/tools/quic/test_tools/quic_test_client.h" | 5 #include "net/tools/quic/test_tools/quic_test_client.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "net/base/completion_callback.h" | 8 #include "net/base/completion_callback.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/cert/cert_verify_result.h" | 10 #include "net/cert/cert_verify_result.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) { | 209 ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) { |
| 210 stream_ = NULL; // Always force creation of a stream for SendMessage. | 210 stream_ = NULL; // Always force creation of a stream for SendMessage. |
| 211 | 211 |
| 212 // If we're not connected, try to find an sni hostname. | 212 // If we're not connected, try to find an sni hostname. |
| 213 if (!connected()) { | 213 if (!connected()) { |
| 214 GURL url(message.headers()->request_uri().as_string()); | 214 GURL url(message.headers()->request_uri().as_string()); |
| 215 if (!url.host().empty()) { | 215 if (!url.host().empty()) { |
| 216 client_->set_server_key( | 216 client_->set_server_key( |
| 217 QuicSessionKey(url.host(), url.EffectiveIntPort(), | 217 QuicSessionKey(url.host(), url.EffectiveIntPort(), |
| 218 url.SchemeIs("https"), kPrivacyModeDisabled)); | 218 url.SchemeIs("https") ? true : false)); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 QuicSpdyClientStream* stream = GetOrCreateStream(); | 222 QuicSpdyClientStream* stream = GetOrCreateStream(); |
| 223 if (!stream) { return 0; } | 223 if (!stream) { return 0; } |
| 224 | 224 |
| 225 scoped_ptr<BalsaHeaders> munged_headers(MungeHeaders(message.headers(), | 225 scoped_ptr<BalsaHeaders> munged_headers(MungeHeaders(message.headers(), |
| 226 secure_)); | 226 secure_)); |
| 227 ssize_t ret = GetOrCreateStream()->SendRequest( | 227 ssize_t ret = GetOrCreateStream()->SendRequest( |
| 228 munged_headers.get() ? *munged_headers.get() : *message.headers(), | 228 munged_headers.get() ? *munged_headers.get() : *message.headers(), |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 459 |
| 460 void QuicTestClient::WaitForWriteToFlush() { | 460 void QuicTestClient::WaitForWriteToFlush() { |
| 461 while (connected() && client()->session()->HasDataToWrite()) { | 461 while (connected() && client()->session()->HasDataToWrite()) { |
| 462 client_->WaitForEvents(); | 462 client_->WaitForEvents(); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 | 465 |
| 466 } // namespace test | 466 } // namespace test |
| 467 } // namespace tools | 467 } // namespace tools |
| 468 } // namespace net | 468 } // namespace net |
| OLD | NEW |