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

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

Issue 2094413002: Add a CTPolicyEnforce to the QUIC commandline client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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_bin.cc ('k') | no next file » | 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 #include "net/quic/quic_server_id.h" 62 #include "net/quic/quic_server_id.h"
63 #include "net/quic/quic_utils.h" 63 #include "net/quic/quic_utils.h"
64 #include "net/spdy/spdy_header_block.h" 64 #include "net/spdy/spdy_header_block.h"
65 #include "net/spdy/spdy_http_utils.h" 65 #include "net/spdy/spdy_http_utils.h"
66 #include "net/tools/quic/quic_simple_client.h" 66 #include "net/tools/quic/quic_simple_client.h"
67 #include "net/tools/quic/synchronous_host_resolver.h" 67 #include "net/tools/quic/synchronous_host_resolver.h"
68 #include "url/gurl.h" 68 #include "url/gurl.h"
69 69
70 using base::StringPiece; 70 using base::StringPiece;
71 using net::CertVerifier; 71 using net::CertVerifier;
72 using net::CTPolicyEnforcer;
72 using net::CTVerifier; 73 using net::CTVerifier;
73 using net::MultiLogCTVerifier; 74 using net::MultiLogCTVerifier;
74 using net::ProofVerifierChromium; 75 using net::ProofVerifierChromium;
75 using net::TransportSecurityState; 76 using net::TransportSecurityState;
76 using std::cout; 77 using std::cout;
77 using std::cerr; 78 using std::cerr;
78 using std::map; 79 using std::map;
79 using std::string; 80 using std::string;
80 using std::vector; 81 using std::vector;
81 using std::endl; 82 using std::endl;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); 246 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version));
246 } 247 }
247 // For secure QUIC we need to verify the cert chain. 248 // For secure QUIC we need to verify the cert chain.
248 std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); 249 std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault());
249 if (line->HasSwitch("disable-certificate-verification")) { 250 if (line->HasSwitch("disable-certificate-verification")) {
250 cert_verifier.reset(new FakeCertVerifier()); 251 cert_verifier.reset(new FakeCertVerifier());
251 } 252 }
252 std::unique_ptr<TransportSecurityState> transport_security_state( 253 std::unique_ptr<TransportSecurityState> transport_security_state(
253 new TransportSecurityState); 254 new TransportSecurityState);
254 std::unique_ptr<CTVerifier> ct_verifier(new MultiLogCTVerifier()); 255 std::unique_ptr<CTVerifier> ct_verifier(new MultiLogCTVerifier());
256 std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer(new CTPolicyEnforcer());
255 ProofVerifierChromium* proof_verifier = new ProofVerifierChromium( 257 ProofVerifierChromium* proof_verifier = new ProofVerifierChromium(
256 cert_verifier.get(), nullptr, transport_security_state.get(), 258 cert_verifier.get(), ct_policy_enforcer.get(),
257 ct_verifier.get()); 259 transport_security_state.get(), ct_verifier.get());
258 net::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id, 260 net::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id,
259 versions, proof_verifier); 261 versions, proof_verifier);
260 client.set_initial_max_packet_length( 262 client.set_initial_max_packet_length(
261 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize); 263 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize);
262 if (!client.Initialize()) { 264 if (!client.Initialize()) {
263 cerr << "Failed to initialize client." << endl; 265 cerr << "Failed to initialize client." << endl;
264 return 1; 266 return 1;
265 } 267 }
266 if (!client.Connect()) { 268 if (!client.Connect()) {
267 net::QuicErrorCode error = client.session()->error(); 269 net::QuicErrorCode error = client.session()->error();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 return 0; 358 return 0;
357 } else { 359 } else {
358 cout << "Request failed (redirect " << response_code << ")." << endl; 360 cout << "Request failed (redirect " << response_code << ")." << endl;
359 return 1; 361 return 1;
360 } 362 }
361 } else { 363 } else {
362 cerr << "Request failed (" << response_code << ")." << endl; 364 cerr << "Request failed (" << response_code << ")." << endl;
363 return 1; 365 return 1;
364 } 366 }
365 } 367 }
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_bin.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698