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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 } | 233 } |
234 ip_addr = addresses[0].address(); | 234 ip_addr = addresses[0].address(); |
235 } | 235 } |
236 | 236 |
237 string host_port = net::IPAddressToStringWithPort(ip_addr, FLAGS_port); | 237 string host_port = net::IPAddressToStringWithPort(ip_addr, FLAGS_port); |
238 VLOG(1) << "Resolved " << host << " to " << host_port << endl; | 238 VLOG(1) << "Resolved " << host << " to " << host_port << endl; |
239 | 239 |
240 // Build the client, and try to connect. | 240 // Build the client, and try to connect. |
241 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), | 241 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), |
242 net::PRIVACY_MODE_DISABLED); | 242 net::PRIVACY_MODE_DISABLED); |
243 net::QuicVersionVector versions = net::QuicSupportedVersions(); | 243 net::QuicVersionVector versions = net::AllSupportedVersions(); |
244 if (FLAGS_quic_version != -1) { | 244 if (FLAGS_quic_version != -1) { |
245 versions.clear(); | 245 versions.clear(); |
246 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); | 246 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); |
247 } | 247 } |
248 // For secure QUIC we need to verify the cert chain. | 248 // For secure QUIC we need to verify the cert chain. |
249 std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); | 249 std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); |
250 if (line->HasSwitch("disable-certificate-verification")) { | 250 if (line->HasSwitch("disable-certificate-verification")) { |
251 cert_verifier.reset(new FakeCertVerifier()); | 251 cert_verifier.reset(new FakeCertVerifier()); |
252 } | 252 } |
253 std::unique_ptr<TransportSecurityState> transport_security_state( | 253 std::unique_ptr<TransportSecurityState> transport_security_state( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 return 0; | 354 return 0; |
355 } else { | 355 } else { |
356 cout << "Request failed (redirect " << response_code << ")." << endl; | 356 cout << "Request failed (redirect " << response_code << ")." << endl; |
357 return 1; | 357 return 1; |
358 } | 358 } |
359 } else { | 359 } else { |
360 cerr << "Request failed (" << response_code << ")." << endl; | 360 cerr << "Request failed (" << response_code << ")." << endl; |
361 return 1; | 361 return 1; |
362 } | 362 } |
363 } | 363 } |
OLD | NEW |