| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 server_id, versions); | 215 server_id, versions); |
| 216 scoped_ptr<CertVerifier> cert_verifier; | 216 scoped_ptr<CertVerifier> cert_verifier; |
| 217 scoped_ptr<TransportSecurityState> transport_security_state; | 217 scoped_ptr<TransportSecurityState> transport_security_state; |
| 218 client.set_initial_max_packet_length( | 218 client.set_initial_max_packet_length( |
| 219 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize); | 219 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize); |
| 220 if (is_https) { | 220 if (is_https) { |
| 221 // For secure QUIC we need to verify the cert chain.a | 221 // For secure QUIC we need to verify the cert chain.a |
| 222 cert_verifier.reset(CertVerifier::CreateDefault()); | 222 cert_verifier.reset(CertVerifier::CreateDefault()); |
| 223 transport_security_state.reset(new TransportSecurityState); | 223 transport_security_state.reset(new TransportSecurityState); |
| 224 client.SetProofVerifier(new ProofVerifierChromium( | 224 client.SetProofVerifier(new ProofVerifierChromium( |
| 225 cert_verifier.get(), transport_security_state.get())); | 225 cert_verifier.get(), nullptr, transport_security_state.get())); |
| 226 } | 226 } |
| 227 if (!client.Initialize()) { | 227 if (!client.Initialize()) { |
| 228 cerr << "Failed to initialize client." << endl; | 228 cerr << "Failed to initialize client." << endl; |
| 229 return 1; | 229 return 1; |
| 230 } | 230 } |
| 231 if (!client.Connect()) { | 231 if (!client.Connect()) { |
| 232 net::QuicErrorCode error = client.session()->error(); | 232 net::QuicErrorCode error = client.session()->error(); |
| 233 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) { | 233 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) { |
| 234 cout << "Server talks QUIC, but none of the versions supported by " | 234 cout << "Server talks QUIC, but none of the versions supported by " |
| 235 << "this client: " << QuicVersionVectorToString(versions) << endl; | 235 << "this client: " << QuicVersionVectorToString(versions) << endl; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 return 0; | 300 return 0; |
| 301 } else { | 301 } else { |
| 302 cout << "Request failed (redirect " << response_code << ")." << endl; | 302 cout << "Request failed (redirect " << response_code << ")." << endl; |
| 303 return 1; | 303 return 1; |
| 304 } | 304 } |
| 305 } else { | 305 } else { |
| 306 cerr << "Request failed (" << response_code << ")." << endl; | 306 cerr << "Request failed (" << response_code << ")." << endl; |
| 307 return 1; | 307 return 1; |
| 308 } | 308 } |
| 309 } | 309 } |
| OLD | NEW |