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

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

Issue 1397983007: relnote: remove insecure QUIC support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rch_insecure_quic
Patch Set: Compile fix 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
« no previous file with comments | « net/tools/quic/quic_simple_client.cc ('k') | net/tools/quic/quic_simple_client_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "net/quic/quic_server_id.h" 59 #include "net/quic/quic_server_id.h"
60 #include "net/quic/quic_utils.h" 60 #include "net/quic/quic_utils.h"
61 #include "net/spdy/spdy_header_block.h" 61 #include "net/spdy/spdy_header_block.h"
62 #include "net/spdy/spdy_http_utils.h" 62 #include "net/spdy/spdy_http_utils.h"
63 #include "net/tools/quic/quic_simple_client.h" 63 #include "net/tools/quic/quic_simple_client.h"
64 #include "net/tools/quic/synchronous_host_resolver.h" 64 #include "net/tools/quic/synchronous_host_resolver.h"
65 #include "url/gurl.h" 65 #include "url/gurl.h"
66 66
67 using base::StringPiece; 67 using base::StringPiece;
68 using net::CertVerifier; 68 using net::CertVerifier;
69 using net::ProofVerifier;
69 using net::ProofVerifierChromium; 70 using net::ProofVerifierChromium;
70 using net::TransportSecurityState; 71 using net::TransportSecurityState;
71 using std::cout; 72 using std::cout;
72 using std::cerr; 73 using std::cerr;
73 using std::map; 74 using std::map;
74 using std::string; 75 using std::string;
75 using std::vector; 76 using std::vector;
76 using std::endl; 77 using std::endl;
77 78
78 // The IP or hostname the quic client will connect to. 79 // The IP or hostname the quic client will connect to.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return 1; 204 return 1;
204 } 205 }
205 ip_addr = addresses[0].address(); 206 ip_addr = addresses[0].address();
206 } 207 }
207 208
208 string host_port = net::IPAddressToStringWithPort(ip_addr, FLAGS_port); 209 string host_port = net::IPAddressToStringWithPort(ip_addr, FLAGS_port);
209 VLOG(1) << "Resolved " << host << " to " << host_port << endl; 210 VLOG(1) << "Resolved " << host << " to " << host_port << endl;
210 211
211 // Build the client, and try to connect. 212 // Build the client, and try to connect.
212 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), 213 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(),
213 /*is_https=*/true, net::PRIVACY_MODE_DISABLED); 214 net::PRIVACY_MODE_DISABLED);
214 net::QuicVersionVector versions = net::QuicSupportedVersions(); 215 net::QuicVersionVector versions = net::QuicSupportedVersions();
215 if (FLAGS_quic_version != -1) { 216 if (FLAGS_quic_version != -1) {
216 versions.clear(); 217 versions.clear();
217 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); 218 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version));
218 } 219 }
220 scoped_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault());
221 scoped_ptr<TransportSecurityState> transport_security_state(
222 new TransportSecurityState);
223 ProofVerifier* proof_verifier = new ProofVerifierChromium(
224 cert_verifier.get(), nullptr, transport_security_state.get());
219 net::tools::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id, 225 net::tools::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id,
220 versions); 226 versions, proof_verifier);
221 scoped_ptr<CertVerifier> cert_verifier;
222 scoped_ptr<TransportSecurityState> transport_security_state;
223 client.set_initial_max_packet_length( 227 client.set_initial_max_packet_length(
224 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize); 228 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize);
225 // For secure QUIC we need to verify the cert chain.
226 cert_verifier = CertVerifier::CreateDefault();
227 transport_security_state.reset(new TransportSecurityState);
228 client.SetProofVerifier(new ProofVerifierChromium(
229 cert_verifier.get(), nullptr, transport_security_state.get()));
230 if (!client.Initialize()) { 229 if (!client.Initialize()) {
231 cerr << "Failed to initialize client." << endl; 230 cerr << "Failed to initialize client." << endl;
232 return 1; 231 return 1;
233 } 232 }
234 if (!client.Connect()) { 233 if (!client.Connect()) {
235 net::QuicErrorCode error = client.session()->error(); 234 net::QuicErrorCode error = client.session()->error();
236 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) { 235 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) {
237 cout << "Server talks QUIC, but none of the versions supported by " 236 cout << "Server talks QUIC, but none of the versions supported by "
238 << "this client: " << QuicVersionVectorToString(versions) << endl; 237 << "this client: " << QuicVersionVectorToString(versions) << endl;
239 // Version mismatch is not deemed a failure. 238 // Version mismatch is not deemed a failure.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 return 0; 302 return 0;
304 } else { 303 } else {
305 cout << "Request failed (redirect " << response_code << ")." << endl; 304 cout << "Request failed (redirect " << response_code << ")." << endl;
306 return 1; 305 return 1;
307 } 306 }
308 } else { 307 } else {
309 cerr << "Request failed (" << response_code << ")." << endl; 308 cerr << "Request failed (" << response_code << ")." << endl;
310 return 1; 309 return 1;
311 } 310 }
312 } 311 }
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_client.cc ('k') | net/tools/quic/quic_simple_client_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698