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