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

Side by Side Diff: net/tools/quic/quic_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_client_base.cc ('k') | net/tools/quic/quic_client_session_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_utils.h" 59 #include "net/quic/quic_utils.h"
60 #include "net/spdy/spdy_header_block.h" 60 #include "net/spdy/spdy_header_block.h"
61 #include "net/tools/epoll_server/epoll_server.h" 61 #include "net/tools/epoll_server/epoll_server.h"
62 #include "net/tools/quic/quic_client.h" 62 #include "net/tools/quic/quic_client.h"
63 #include "net/tools/quic/spdy_balsa_utils.h" 63 #include "net/tools/quic/spdy_balsa_utils.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::string; 74 using std::string;
74 using std::vector; 75 using std::vector;
75 using std::endl; 76 using std::endl;
76 77
77 // The IP or hostname the quic client will connect to. 78 // The IP or hostname the quic client will connect to.
78 string FLAGS_host = ""; 79 string FLAGS_host = "";
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 202 }
202 ip_addr = addresses[0].address(); 203 ip_addr = addresses[0].address();
203 } 204 }
204 205
205 string host_port = net::IPAddressToStringWithPort(ip_addr, port); 206 string host_port = net::IPAddressToStringWithPort(ip_addr, port);
206 VLOG(1) << "Resolved " << host << " to " << host_port << endl; 207 VLOG(1) << "Resolved " << host << " to " << host_port << endl;
207 208
208 // Build the client, and try to connect. 209 // Build the client, and try to connect.
209 net::EpollServer epoll_server; 210 net::EpollServer epoll_server;
210 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), 211 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(),
211 /*is_https=*/true, net::PRIVACY_MODE_DISABLED); 212 net::PRIVACY_MODE_DISABLED);
212 net::QuicVersionVector versions = net::QuicSupportedVersions(); 213 net::QuicVersionVector versions = net::QuicSupportedVersions();
213 if (FLAGS_quic_version != -1) { 214 if (FLAGS_quic_version != -1) {
214 versions.clear(); 215 versions.clear();
215 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); 216 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version));
216 } 217 }
218 scoped_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault());
219 scoped_ptr<TransportSecurityState> transport_security_state(
220 new TransportSecurityState);
221 ProofVerifier* proof_verifier = new ProofVerifierChromium(
222 cert_verifier.get(), nullptr, transport_security_state.get());
217 net::tools::QuicClient client(net::IPEndPoint(ip_addr, port), server_id, 223 net::tools::QuicClient client(net::IPEndPoint(ip_addr, port), server_id,
218 versions, &epoll_server); 224 versions, &epoll_server, proof_verifier);
219 scoped_ptr<CertVerifier> cert_verifier;
220 scoped_ptr<TransportSecurityState> transport_security_state;
221 client.set_initial_max_packet_length( 225 client.set_initial_max_packet_length(
222 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize); 226 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize);
223 // For secure QUIC we need to verify the cert chain.
224 cert_verifier = CertVerifier::CreateDefault();
225 transport_security_state.reset(new TransportSecurityState);
226 client.SetProofVerifier(new ProofVerifierChromium(
227 cert_verifier.get(), nullptr, transport_security_state.get()));
228 if (!client.Initialize()) { 227 if (!client.Initialize()) {
229 cerr << "Failed to initialize client." << endl; 228 cerr << "Failed to initialize client." << endl;
230 return 1; 229 return 1;
231 } 230 }
232 if (!client.Connect()) { 231 if (!client.Connect()) {
233 net::QuicErrorCode error = client.session()->error(); 232 net::QuicErrorCode error = client.session()->error();
234 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) { 233 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) {
235 cout << "Server talks QUIC, but none of the versions supported by " 234 cout << "Server talks QUIC, but none of the versions supported by "
236 << "this client: " << QuicVersionVectorToString(versions) << endl; 235 << "this client: " << QuicVersionVectorToString(versions) << endl;
237 // Version mismatch is not deemed a failure. 236 // Version mismatch is not deemed a failure.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 return 0; 299 return 0;
301 } else { 300 } else {
302 cout << "Request failed (redirect " << response_code << ")." << endl; 301 cout << "Request failed (redirect " << response_code << ")." << endl;
303 return 1; 302 return 1;
304 } 303 }
305 } else { 304 } else {
306 cerr << "Request failed (" << response_code << ")." << endl; 305 cerr << "Request failed (" << response_code << ")." << endl;
307 return 1; 306 return 1;
308 } 307 }
309 } 308 }
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_base.cc ('k') | net/tools/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698