| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); | 236 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); |
| 237 } | 237 } |
| 238 // For secure QUIC we need to verify the cert chain. | 238 // For secure QUIC we need to verify the cert chain. |
| 239 scoped_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); | 239 scoped_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); |
| 240 if (line->HasSwitch("disable-certificate-verification")) { | 240 if (line->HasSwitch("disable-certificate-verification")) { |
| 241 cert_verifier.reset(new FakeCertVerifier()); | 241 cert_verifier.reset(new FakeCertVerifier()); |
| 242 } | 242 } |
| 243 scoped_ptr<TransportSecurityState> transport_security_state( | 243 scoped_ptr<TransportSecurityState> transport_security_state( |
| 244 new TransportSecurityState); | 244 new TransportSecurityState); |
| 245 ProofVerifierChromium* proof_verifier = new ProofVerifierChromium( | 245 ProofVerifierChromium* proof_verifier = new ProofVerifierChromium( |
| 246 cert_verifier.get(), nullptr, transport_security_state.get()); | 246 cert_verifier.get(), nullptr, transport_security_state.get(), nullptr); |
| 247 net::tools::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id, | 247 net::tools::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id, |
| 248 versions, proof_verifier); | 248 versions, proof_verifier); |
| 249 client.set_initial_max_packet_length( | 249 client.set_initial_max_packet_length( |
| 250 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize); | 250 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize); |
| 251 if (!client.Initialize()) { | 251 if (!client.Initialize()) { |
| 252 cerr << "Failed to initialize client." << endl; | 252 cerr << "Failed to initialize client." << endl; |
| 253 return 1; | 253 return 1; |
| 254 } | 254 } |
| 255 if (!client.Connect()) { | 255 if (!client.Connect()) { |
| 256 net::QuicErrorCode error = client.session()->error(); | 256 net::QuicErrorCode error = client.session()->error(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return 0; | 324 return 0; |
| 325 } else { | 325 } else { |
| 326 cout << "Request failed (redirect " << response_code << ")." << endl; | 326 cout << "Request failed (redirect " << response_code << ")." << endl; |
| 327 return 1; | 327 return 1; |
| 328 } | 328 } |
| 329 } else { | 329 } else { |
| 330 cerr << "Request failed (" << response_code << ")." << endl; | 330 cerr << "Request failed (" << response_code << ")." << endl; |
| 331 return 1; | 331 return 1; |
| 332 } | 332 } |
| 333 } | 333 } |
| OLD | NEW |