| 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> |
| 8 |
| 7 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 8 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
| 9 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 10 #include "net/cert/cert_verify_result.h" | 12 #include "net/cert/cert_verify_result.h" |
| 11 #include "net/cert/x509_certificate.h" | 13 #include "net/cert/x509_certificate.h" |
| 12 #include "net/quic/crypto/proof_verifier.h" | 14 #include "net/quic/crypto/proof_verifier.h" |
| 13 #include "net/quic/quic_flags.h" | 15 #include "net/quic/quic_flags.h" |
| 14 #include "net/quic/quic_server_id.h" | 16 #include "net/quic/quic_server_id.h" |
| 15 #include "net/quic/test_tools/quic_connection_peer.h" | 17 #include "net/quic/test_tools/quic_connection_peer.h" |
| 16 #include "net/quic/test_tools/quic_spdy_session_peer.h" | 18 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 45 QuicAsyncStatus VerifyProof(const string& hostname, | 47 QuicAsyncStatus VerifyProof(const string& hostname, |
| 46 const uint16_t port, | 48 const uint16_t port, |
| 47 const string& server_config, | 49 const string& server_config, |
| 48 QuicVersion quic_version, | 50 QuicVersion quic_version, |
| 49 StringPiece chlo_hash, | 51 StringPiece chlo_hash, |
| 50 const vector<string>& certs, | 52 const vector<string>& certs, |
| 51 const string& cert_sct, | 53 const string& cert_sct, |
| 52 const string& signature, | 54 const string& signature, |
| 53 const ProofVerifyContext* context, | 55 const ProofVerifyContext* context, |
| 54 string* error_details, | 56 string* error_details, |
| 55 scoped_ptr<ProofVerifyDetails>* details, | 57 std::unique_ptr<ProofVerifyDetails>* details, |
| 56 ProofVerifierCallback* callback) override { | 58 ProofVerifierCallback* callback) override { |
| 57 common_name_.clear(); | 59 common_name_.clear(); |
| 58 if (certs.empty()) { | 60 if (certs.empty()) { |
| 59 return QUIC_FAILURE; | 61 return QUIC_FAILURE; |
| 60 } | 62 } |
| 61 | 63 |
| 62 // Convert certs to X509Certificate. | 64 // Convert certs to X509Certificate. |
| 63 vector<StringPiece> cert_pieces(certs.size()); | 65 vector<StringPiece> cert_pieces(certs.size()); |
| 64 for (unsigned i = 0; i < certs.size(); i++) { | 66 for (unsigned i = 0; i < certs.size(); i++) { |
| 65 cert_pieces[i] = StringPiece(certs[i]); | 67 cert_pieces[i] = StringPiece(certs[i]); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 if (!url.host().empty()) { | 306 if (!url.host().empty()) { |
| 305 client_->set_server_id(QuicServerId(url.host(), url.EffectiveIntPort(), | 307 client_->set_server_id(QuicServerId(url.host(), url.EffectiveIntPort(), |
| 306 PRIVACY_MODE_DISABLED)); | 308 PRIVACY_MODE_DISABLED)); |
| 307 } | 309 } |
| 308 } | 310 } |
| 309 | 311 |
| 310 // TODO(rtenneti): Add support for HTTPMessage::body_chunks(). | 312 // TODO(rtenneti): Add support for HTTPMessage::body_chunks(). |
| 311 // CHECK(message.body_chunks().empty()) | 313 // CHECK(message.body_chunks().empty()) |
| 312 // << "HTTPMessage::body_chunks not supported"; | 314 // << "HTTPMessage::body_chunks not supported"; |
| 313 | 315 |
| 314 scoped_ptr<BalsaHeaders> munged_headers(MungeHeaders(message.headers())); | 316 std::unique_ptr<BalsaHeaders> munged_headers(MungeHeaders(message.headers())); |
| 315 ssize_t ret = GetOrCreateStreamAndSendRequest( | 317 ssize_t ret = GetOrCreateStreamAndSendRequest( |
| 316 (munged_headers.get() ? munged_headers.get() : message.headers()), | 318 (munged_headers.get() ? munged_headers.get() : message.headers()), |
| 317 message.body(), message.has_complete_message(), nullptr); | 319 message.body(), message.has_complete_message(), nullptr); |
| 318 WaitForWriteToFlush(); | 320 WaitForWriteToFlush(); |
| 319 return ret; | 321 return ret; |
| 320 } | 322 } |
| 321 | 323 |
| 322 ssize_t QuicTestClient::SendData(const string& data, bool last_data) { | 324 ssize_t QuicTestClient::SendData(const string& data, bool last_data) { |
| 323 return SendData(data, last_data, nullptr); | 325 return SendData(data, last_data, nullptr); |
| 324 } | 326 } |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 CHECK(message); | 669 CHECK(message); |
| 668 message->headers()->SetRequestVersion( | 670 message->headers()->SetRequestVersion( |
| 669 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); | 671 HTTPMessage::VersionToString(HttpConstants::HTTP_1_1)); |
| 670 message->headers()->SetRequestMethod( | 672 message->headers()->SetRequestMethod( |
| 671 HTTPMessage::MethodToString(HttpConstants::GET)); | 673 HTTPMessage::MethodToString(HttpConstants::GET)); |
| 672 message->headers()->SetRequestUri(uri); | 674 message->headers()->SetRequestUri(uri); |
| 673 } | 675 } |
| 674 | 676 |
| 675 } // namespace test | 677 } // namespace test |
| 676 } // namespace net | 678 } // namespace net |
| OLD | NEW |