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

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

Issue 1454993002: QUIC - Code to verify SCT tag with certificate transparency verifier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase with TOT - use scoped_refptr<const CTLogVerifier> Created 5 years 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "base/command_line.h" 44 #include "base/command_line.h"
45 #include "base/logging.h" 45 #include "base/logging.h"
46 #include "base/message_loop/message_loop.h" 46 #include "base/message_loop/message_loop.h"
47 #include "base/strings/string_number_conversions.h" 47 #include "base/strings/string_number_conversions.h"
48 #include "base/strings/string_split.h" 48 #include "base/strings/string_split.h"
49 #include "base/strings/string_util.h" 49 #include "base/strings/string_util.h"
50 #include "net/base/ip_endpoint.h" 50 #include "net/base/ip_endpoint.h"
51 #include "net/base/net_errors.h" 51 #include "net/base/net_errors.h"
52 #include "net/base/privacy_mode.h" 52 #include "net/base/privacy_mode.h"
53 #include "net/cert/cert_verifier.h" 53 #include "net/cert/cert_verifier.h"
54 #include "net/cert/multi_log_ct_verifier.h"
54 #include "net/http/http_request_info.h" 55 #include "net/http/http_request_info.h"
55 #include "net/http/transport_security_state.h" 56 #include "net/http/transport_security_state.h"
56 #include "net/log/net_log.h" 57 #include "net/log/net_log.h"
57 #include "net/quic/crypto/proof_verifier_chromium.h" 58 #include "net/quic/crypto/proof_verifier_chromium.h"
58 #include "net/quic/quic_protocol.h" 59 #include "net/quic/quic_protocol.h"
59 #include "net/quic/quic_server_id.h" 60 #include "net/quic/quic_server_id.h"
60 #include "net/quic/quic_utils.h" 61 #include "net/quic/quic_utils.h"
61 #include "net/spdy/spdy_header_block.h" 62 #include "net/spdy/spdy_header_block.h"
62 #include "net/spdy/spdy_http_utils.h" 63 #include "net/spdy/spdy_http_utils.h"
63 #include "net/tools/quic/quic_simple_client.h" 64 #include "net/tools/quic/quic_simple_client.h"
64 #include "net/tools/quic/synchronous_host_resolver.h" 65 #include "net/tools/quic/synchronous_host_resolver.h"
65 #include "url/gurl.h" 66 #include "url/gurl.h"
66 67
67 using base::StringPiece; 68 using base::StringPiece;
68 using net::CertVerifier; 69 using net::CertVerifier;
70 using net::CTVerifier;
71 using net::MultiLogCTVerifier;
69 using net::ProofVerifierChromium; 72 using net::ProofVerifierChromium;
70 using net::TransportSecurityState; 73 using net::TransportSecurityState;
71 using std::cout; 74 using std::cout;
72 using std::cerr; 75 using std::cerr;
73 using std::map; 76 using std::map;
74 using std::string; 77 using std::string;
75 using std::vector; 78 using std::vector;
76 using std::endl; 79 using std::endl;
77 80
78 // The IP or hostname the quic client will connect to. 81 // The IP or hostname the quic client will connect to.
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 versions.clear(); 238 versions.clear();
236 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); 239 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version));
237 } 240 }
238 // For secure QUIC we need to verify the cert chain. 241 // For secure QUIC we need to verify the cert chain.
239 scoped_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); 242 scoped_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault());
240 if (line->HasSwitch("disable-certificate-verification")) { 243 if (line->HasSwitch("disable-certificate-verification")) {
241 cert_verifier.reset(new FakeCertVerifier()); 244 cert_verifier.reset(new FakeCertVerifier());
242 } 245 }
243 scoped_ptr<TransportSecurityState> transport_security_state( 246 scoped_ptr<TransportSecurityState> transport_security_state(
244 new TransportSecurityState); 247 new TransportSecurityState);
248 scoped_ptr<CTVerifier> ct_verifier(new MultiLogCTVerifier());
245 ProofVerifierChromium* proof_verifier = new ProofVerifierChromium( 249 ProofVerifierChromium* proof_verifier = new ProofVerifierChromium(
246 cert_verifier.get(), nullptr, transport_security_state.get()); 250 cert_verifier.get(), nullptr, transport_security_state.get(),
251 ct_verifier.get());
247 net::tools::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id, 252 net::tools::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id,
248 versions, proof_verifier); 253 versions, proof_verifier);
249 client.set_initial_max_packet_length( 254 client.set_initial_max_packet_length(
250 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize); 255 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize);
251 if (!client.Initialize()) { 256 if (!client.Initialize()) {
252 cerr << "Failed to initialize client." << endl; 257 cerr << "Failed to initialize client." << endl;
253 return 1; 258 return 1;
254 } 259 }
255 if (!client.Connect()) { 260 if (!client.Connect()) {
256 net::QuicErrorCode error = client.session()->error(); 261 net::QuicErrorCode error = client.session()->error();
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 return 0; 329 return 0;
325 } else { 330 } else {
326 cout << "Request failed (redirect " << response_code << ")." << endl; 331 cout << "Request failed (redirect " << response_code << ")." << endl;
327 return 1; 332 return 1;
328 } 333 }
329 } else { 334 } else {
330 cerr << "Request failed (" << response_code << ")." << endl; 335 cerr << "Request failed (" << response_code << ")." << endl;
331 return 1; 336 return 1;
332 } 337 }
333 } 338 }
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