| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 } | 297 } |
| 298 return ret; | 298 return ret; |
| 299 } | 299 } |
| 300 | 300 |
| 301 ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) { | 301 ssize_t QuicTestClient::SendMessage(const HTTPMessage& message) { |
| 302 stream_ = nullptr; // Always force creation of a stream for SendMessage. | 302 stream_ = nullptr; // Always force creation of a stream for SendMessage. |
| 303 | 303 |
| 304 // If we're not connected, try to find an sni hostname. | 304 // If we're not connected, try to find an sni hostname. |
| 305 if (!connected()) { | 305 if (!connected()) { |
| 306 GURL url(message.headers()->request_uri().as_string()); | 306 GURL url(message.headers()->request_uri().as_string()); |
| 307 if (!url.host().empty()) { | 307 if (override_sni_set_) { |
| 308 client_->set_server_id(QuicServerId(url.host(), url.EffectiveIntPort(), | 308 client_->set_server_id(QuicServerId(override_sni_, url.EffectiveIntPort(), |
| 309 PRIVACY_MODE_DISABLED)); | 309 PRIVACY_MODE_DISABLED)); |
| 310 } else { |
| 311 if (!url.host().empty()) { |
| 312 client_->set_server_id(QuicServerId(url.host(), url.EffectiveIntPort(), |
| 313 PRIVACY_MODE_DISABLED)); |
| 314 } |
| 310 } | 315 } |
| 311 } | 316 } |
| 312 | 317 |
| 313 // TODO(rtenneti): Add support for HTTPMessage::body_chunks(). | 318 // TODO(rtenneti): Add support for HTTPMessage::body_chunks(). |
| 314 // CHECK(message.body_chunks().empty()) | 319 // CHECK(message.body_chunks().empty()) |
| 315 // << "HTTPMessage::body_chunks not supported"; | 320 // << "HTTPMessage::body_chunks not supported"; |
| 316 | 321 |
| 317 std::unique_ptr<BalsaHeaders> munged_headers(MungeHeaders(message.headers())); | 322 std::unique_ptr<BalsaHeaders> munged_headers(MungeHeaders(message.headers())); |
| 318 ssize_t ret = GetOrCreateStreamAndSendRequest( | 323 ssize_t ret = GetOrCreateStreamAndSendRequest( |
| 319 (munged_headers.get() ? munged_headers.get() : message.headers()), | 324 (munged_headers.get() ? munged_headers.get() : message.headers()), |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 CHECK(message); | 675 CHECK(message); |
| 671 message->headers()->SetRequestVersion( | 676 message->headers()->SetRequestVersion( |
| 672 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); | 677 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); |
| 673 message->headers()->SetRequestMethod( | 678 message->headers()->SetRequestMethod( |
| 674 HTTPMessage::MethodToString(HttpConstants::GET)); | 679 HTTPMessage::MethodToString(HttpConstants::GET)); |
| 675 message->headers()->SetRequestUri(uri); | 680 message->headers()->SetRequestUri(uri); |
| 676 } | 681 } |
| 677 | 682 |
| 678 } // namespace test | 683 } // namespace test |
| 679 } // namespace net | 684 } // namespace net |
| OLD | NEW |