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