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

Side by Side Diff: net/tools/quic/quic_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 | « no previous file | net/tools/quic/quic_simple_client_bin.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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/tools/epoll_server/epoll_server.h" 65 #include "net/tools/epoll_server/epoll_server.h"
66 #include "net/tools/quic/quic_client.h" 66 #include "net/tools/quic/quic_client.h"
67 #include "net/tools/quic/spdy_balsa_utils.h" 67 #include "net/tools/quic/spdy_balsa_utils.h"
68 #include "net/tools/quic/synchronous_host_resolver.h" 68 #include "net/tools/quic/synchronous_host_resolver.h"
69 #include "url/gurl.h" 69 #include "url/gurl.h"
70 70
71 using base::StringPiece; 71 using base::StringPiece;
72 using net::CertVerifier; 72 using net::CertVerifier;
73 using net::CTPolicyEnforcer;
73 using net::CTVerifier; 74 using net::CTVerifier;
74 using net::MultiLogCTVerifier; 75 using net::MultiLogCTVerifier;
75 using net::ProofVerifierChromium; 76 using net::ProofVerifierChromium;
76 using net::TransportSecurityState; 77 using net::TransportSecurityState;
77 using std::cout; 78 using std::cout;
78 using std::cerr; 79 using std::cerr;
79 using std::string; 80 using std::string;
80 using std::vector; 81 using std::vector;
81 using std::endl; 82 using std::endl;
82 83
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 246 }
246 // For secure QUIC we need to verify the cert chain. 247 // For secure QUIC we need to verify the cert chain.
247 std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); 248 std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault());
248 if (line->HasSwitch("disable-certificate-verification")) { 249 if (line->HasSwitch("disable-certificate-verification")) {
249 cert_verifier.reset(new FakeCertVerifier()); 250 cert_verifier.reset(new FakeCertVerifier());
250 } 251 }
251 std::unique_ptr<TransportSecurityState> transport_security_state( 252 std::unique_ptr<TransportSecurityState> transport_security_state(
252 new TransportSecurityState); 253 new TransportSecurityState);
253 transport_security_state.reset(new TransportSecurityState); 254 transport_security_state.reset(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::QuicClient client(net::IPEndPoint(ip_addr, FLAGS_port), server_id, 260 net::QuicClient client(net::IPEndPoint(ip_addr, FLAGS_port), server_id,
259 versions, &epoll_server, proof_verifier); 261 versions, &epoll_server, 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 return 0; 357 return 0;
356 } else { 358 } else {
357 cout << "Request failed (redirect " << response_code << ")." << endl; 359 cout << "Request failed (redirect " << response_code << ")." << endl;
358 return 1; 360 return 1;
359 } 361 }
360 } else { 362 } else {
361 cerr << "Request failed (" << response_code << ")." << endl; 363 cerr << "Request failed (" << response_code << ")." << endl;
362 return 1; 364 return 1;
363 } 365 }
364 } 366 }
OLDNEW
« no previous file with comments | « no previous file | net/tools/quic/quic_simple_client_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698