| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 net::tools::QuicClient client(net::IPEndPoint(ip_addr, FLAGS_port), server_id, | 202 net::tools::QuicClient client(net::IPEndPoint(ip_addr, FLAGS_port), server_id, |
| 203 versions, &epoll_server); | 203 versions, &epoll_server); |
| 204 scoped_ptr<CertVerifier> cert_verifier; | 204 scoped_ptr<CertVerifier> cert_verifier; |
| 205 scoped_ptr<TransportSecurityState> transport_security_state; | 205 scoped_ptr<TransportSecurityState> transport_security_state; |
| 206 if (is_https) { | 206 if (is_https) { |
| 207 // For secure QUIC we need to verify the cert chain.a | 207 // For secure QUIC we need to verify the cert chain.a |
| 208 cert_verifier.reset(CertVerifier::CreateDefault()); | 208 cert_verifier.reset(CertVerifier::CreateDefault()); |
| 209 transport_security_state.reset(new TransportSecurityState); | 209 transport_security_state.reset(new TransportSecurityState); |
| 210 // TODO(rtenneti): Fix "Proof invalid: Missing context" error. | 210 // TODO(rtenneti): Fix "Proof invalid: Missing context" error. |
| 211 client.SetProofVerifier(new ProofVerifierChromium( | 211 client.SetProofVerifier(new ProofVerifierChromium( |
| 212 cert_verifier.get(), transport_security_state.get())); | 212 cert_verifier.get(), nullptr, transport_security_state.get())); |
| 213 } | 213 } |
| 214 if (!client.Initialize()) { | 214 if (!client.Initialize()) { |
| 215 cerr << "Failed to initialize client." << endl; | 215 cerr << "Failed to initialize client." << endl; |
| 216 return 1; | 216 return 1; |
| 217 } | 217 } |
| 218 if (!client.Connect()) { | 218 if (!client.Connect()) { |
| 219 net::QuicErrorCode error = client.session()->error(); | 219 net::QuicErrorCode error = client.session()->error(); |
| 220 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) { | 220 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) { |
| 221 cout << "Server talks QUIC, but none of the versions supported by " | 221 cout << "Server talks QUIC, but none of the versions supported by " |
| 222 << "this client: " << QuicVersionVectorToString(versions) << endl; | 222 << "this client: " << QuicVersionVectorToString(versions) << endl; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 return 0; | 286 return 0; |
| 287 } else { | 287 } else { |
| 288 cout << "Request failed (redirect " << response_code << ")." << endl; | 288 cout << "Request failed (redirect " << response_code << ")." << endl; |
| 289 return 1; | 289 return 1; |
| 290 } | 290 } |
| 291 } else { | 291 } else { |
| 292 cerr << "Request failed (" << response_code << ")." << endl; | 292 cerr << "Request failed (" << response_code << ")." << endl; |
| 293 return 1; | 293 return 1; |
| 294 } | 294 } |
| 295 } | 295 } |
| OLD | NEW |