Chromium Code Reviews| 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 // A binary wrapper for QuicClient. | 5 // A binary wrapper for QuicClient. |
| 6 // Connects to a host using QUIC, sends a request to the provided URL, and | 6 // Connects to a host using QUIC, sends a request to the provided URL, and |
| 7 // displays the response. | 7 // displays the response. |
| 8 // | 8 // |
| 9 // Some usage examples: | 9 // Some usage examples: |
| 10 // | 10 // |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 // quic_client http://www.example.com --host=${IP} | 39 // quic_client http://www.example.com --host=${IP} |
| 40 | 40 |
| 41 #include <iostream> | 41 #include <iostream> |
| 42 | 42 |
| 43 #include "base/at_exit.h" | 43 #include "base/at_exit.h" |
| 44 #include "base/command_line.h" | 44 #include "base/command_line.h" |
| 45 #include "base/message_loop/message_loop.h" | 45 #include "base/message_loop/message_loop.h" |
| 46 #include "net/base/net_errors.h" | 46 #include "net/base/net_errors.h" |
| 47 #include "net/base/privacy_mode.h" | 47 #include "net/base/privacy_mode.h" |
| 48 #include "net/cert/cert_verifier.h" | 48 #include "net/cert/cert_verifier.h" |
| 49 #include "net/cert/ct_known_logs.h" | |
| 50 #include "net/cert/ct_log_verifier.h" | |
| 49 #include "net/cert/multi_log_ct_verifier.h" | 51 #include "net/cert/multi_log_ct_verifier.h" |
| 50 #include "net/http/transport_security_state.h" | 52 #include "net/http/transport_security_state.h" |
| 51 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" | 53 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" |
| 52 #include "net/quic/core/quic_flags.h" | 54 #include "net/quic/core/quic_flags.h" |
| 53 #include "net/quic/core/quic_packets.h" | 55 #include "net/quic/core/quic_packets.h" |
| 54 #include "net/quic/core/quic_server_id.h" | 56 #include "net/quic/core/quic_server_id.h" |
| 55 #include "net/quic/platform/api/quic_socket_address.h" | 57 #include "net/quic/platform/api/quic_socket_address.h" |
| 56 #include "net/quic/platform/api/quic_str_cat.h" | 58 #include "net/quic/platform/api/quic_str_cat.h" |
| 57 #include "net/quic/platform/api/quic_text_utils.h" | 59 #include "net/quic/platform/api/quic_text_utils.h" |
| 58 #include "net/spdy/spdy_header_block.h" | 60 #include "net/spdy/spdy_header_block.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 net::PRIVACY_MODE_DISABLED); | 253 net::PRIVACY_MODE_DISABLED); |
| 252 net::QuicVersionVector versions = net::AllSupportedVersions(); | 254 net::QuicVersionVector versions = net::AllSupportedVersions(); |
| 253 if (FLAGS_quic_version != -1) { | 255 if (FLAGS_quic_version != -1) { |
| 254 versions.clear(); | 256 versions.clear(); |
| 255 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); | 257 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); |
| 256 } | 258 } |
| 257 // For secure QUIC we need to verify the cert chain. | 259 // For secure QUIC we need to verify the cert chain. |
| 258 std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); | 260 std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); |
| 259 std::unique_ptr<TransportSecurityState> transport_security_state( | 261 std::unique_ptr<TransportSecurityState> transport_security_state( |
| 260 new TransportSecurityState); | 262 new TransportSecurityState); |
| 261 std::unique_ptr<CTVerifier> ct_verifier(new MultiLogCTVerifier()); | 263 std::unique_ptr<MultiLogCTVerifier> ct_verifier(new MultiLogCTVerifier()); |
| 264 ct_verifier->AddLogs(net::ct::CreateLogVerifiersForKnownLogs()); | |
|
Ryan Sleevi
2017/02/03 21:41:25
Should the QUIC client instead be disabling CT enf
Ryan Hamilton
2017/02/03 22:02:37
Ah! Thanks for checking. I believe there is no dan
| |
| 262 std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer(new CTPolicyEnforcer()); | 265 std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer(new CTPolicyEnforcer()); |
| 263 std::unique_ptr<ProofVerifier> proof_verifier; | 266 std::unique_ptr<ProofVerifier> proof_verifier; |
| 264 if (line->HasSwitch("disable-certificate-verification")) { | 267 if (line->HasSwitch("disable-certificate-verification")) { |
| 265 proof_verifier.reset(new FakeProofVerifier()); | 268 proof_verifier.reset(new FakeProofVerifier()); |
| 266 } else { | 269 } else { |
| 267 proof_verifier.reset(new ProofVerifierChromium( | 270 proof_verifier.reset(new ProofVerifierChromium( |
| 268 cert_verifier.get(), ct_policy_enforcer.get(), | 271 cert_verifier.get(), ct_policy_enforcer.get(), |
| 269 transport_security_state.get(), ct_verifier.get())); | 272 transport_security_state.get(), ct_verifier.get())); |
| 270 } | 273 } |
| 271 net::QuicClient client(net::QuicSocketAddress(ip_addr, port), server_id, | 274 net::QuicClient client(net::QuicSocketAddress(ip_addr, port), server_id, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 return 0; | 360 return 0; |
| 358 } else { | 361 } else { |
| 359 cout << "Request failed (redirect " << response_code << ")." << endl; | 362 cout << "Request failed (redirect " << response_code << ")." << endl; |
| 360 return 1; | 363 return 1; |
| 361 } | 364 } |
| 362 } else { | 365 } else { |
| 363 cerr << "Request failed (" << response_code << ")." << endl; | 366 cerr << "Request failed (" << response_code << ")." << endl; |
| 364 return 1; | 367 return 1; |
| 365 } | 368 } |
| 366 } | 369 } |
| OLD | NEW |