Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1103)

Side by Side Diff: net/tools/quic/quic_simple_client_bin.cc

Issue 1411063004: Remove insecure QUIC support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return 1; 203 return 1;
204 } 204 }
205 ip_addr = addresses[0].address(); 205 ip_addr = addresses[0].address();
206 } 206 }
207 207
208 string host_port = net::IPAddressToStringWithPort(ip_addr, FLAGS_port); 208 string host_port = net::IPAddressToStringWithPort(ip_addr, FLAGS_port);
209 VLOG(1) << "Resolved " << host << " to " << host_port << endl; 209 VLOG(1) << "Resolved " << host << " to " << host_port << endl;
210 210
211 // Build the client, and try to connect. 211 // Build the client, and try to connect.
212 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), 212 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(),
213 /*is_https=*/true, net::PRIVACY_MODE_DISABLED); 213 net::PRIVACY_MODE_DISABLED);
214 net::QuicVersionVector versions = net::QuicSupportedVersions(); 214 net::QuicVersionVector versions = net::QuicSupportedVersions();
215 if (FLAGS_quic_version != -1) { 215 if (FLAGS_quic_version != -1) {
216 versions.clear(); 216 versions.clear();
217 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); 217 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version));
218 } 218 }
219 net::tools::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id,
220 versions);
221 scoped_ptr<CertVerifier> cert_verifier; 219 scoped_ptr<CertVerifier> cert_verifier;
222 scoped_ptr<TransportSecurityState> transport_security_state; 220 scoped_ptr<TransportSecurityState> transport_security_state;
221 ProofVerifierChromium* proof_verifier =
222 new ProofVerifierChromium(
223 cert_verifier.get(), nullptr, transport_security_state.get());
224 net::tools::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id,
225 versions, proof_verifier);
223 client.set_initial_max_packet_length( 226 client.set_initial_max_packet_length(
224 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize); 227 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize);
225 // For secure QUIC we need to verify the cert chain. 228 // For secure QUIC we need to verify the cert chain.
226 cert_verifier = CertVerifier::CreateDefault(); 229 cert_verifier = CertVerifier::CreateDefault();
227 transport_security_state.reset(new TransportSecurityState); 230 transport_security_state.reset(new TransportSecurityState);
228 client.SetProofVerifier(new ProofVerifierChromium(
229 cert_verifier.get(), nullptr, transport_security_state.get()));
230 if (!client.Initialize()) { 231 if (!client.Initialize()) {
231 cerr << "Failed to initialize client." << endl; 232 cerr << "Failed to initialize client." << endl;
232 return 1; 233 return 1;
233 } 234 }
234 if (!client.Connect()) { 235 if (!client.Connect()) {
235 net::QuicErrorCode error = client.session()->error(); 236 net::QuicErrorCode error = client.session()->error();
236 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) { 237 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) {
237 cout << "Server talks QUIC, but none of the versions supported by " 238 cout << "Server talks QUIC, but none of the versions supported by "
238 << "this client: " << QuicVersionVectorToString(versions) << endl; 239 << "this client: " << QuicVersionVectorToString(versions) << endl;
239 // Version mismatch is not deemed a failure. 240 // Version mismatch is not deemed a failure.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 return 0; 304 return 0;
304 } else { 305 } else {
305 cout << "Request failed (redirect " << response_code << ")." << endl; 306 cout << "Request failed (redirect " << response_code << ")." << endl;
306 return 1; 307 return 1;
307 } 308 }
308 } else { 309 } else {
309 cerr << "Request failed (" << response_code << ")." << endl; 310 cerr << "Request failed (" << response_code << ")." << endl;
310 return 1; 311 return 1;
311 } 312 }
312 } 313 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698