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

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

Issue 1893083002: Change scoped_ptr to std::unique_ptr in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-net-all: iwyu Created 4 years, 8 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_server.h » ('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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 class FakeCertVerifier : public net::CertVerifier { 108 class FakeCertVerifier : public net::CertVerifier {
109 public: 109 public:
110 int Verify(net::X509Certificate* cert, 110 int Verify(net::X509Certificate* cert,
111 const std::string& hostname, 111 const std::string& hostname,
112 const std::string& ocsp_response, 112 const std::string& ocsp_response,
113 int flags, 113 int flags,
114 net::CRLSet* crl_set, 114 net::CRLSet* crl_set,
115 net::CertVerifyResult* verify_result, 115 net::CertVerifyResult* verify_result,
116 const net::CompletionCallback& callback, 116 const net::CompletionCallback& callback,
117 scoped_ptr<net::CertVerifier::Request>* out_req, 117 std::unique_ptr<net::CertVerifier::Request>* out_req,
118 const net::BoundNetLog& net_log) override { 118 const net::BoundNetLog& net_log) override {
119 return net::OK; 119 return net::OK;
120 } 120 }
121 121
122 // Returns true if this CertVerifier supports stapled OCSP responses. 122 // Returns true if this CertVerifier supports stapled OCSP responses.
123 bool SupportsOCSPStapling() override { return false; } 123 bool SupportsOCSPStapling() override { return false; }
124 }; 124 };
125 125
126 static bool DecodeHexString(const base::StringPiece& hex, std::string* bytes) { 126 static bool DecodeHexString(const base::StringPiece& hex, std::string* bytes) {
127 bytes->clear(); 127 bytes->clear();
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 269
270 // Build the client, and try to connect. 270 // Build the client, and try to connect.
271 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), 271 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(),
272 net::PRIVACY_MODE_DISABLED); 272 net::PRIVACY_MODE_DISABLED);
273 net::QuicVersionVector versions = net::QuicSupportedVersions(); 273 net::QuicVersionVector versions = net::QuicSupportedVersions();
274 if (FLAGS_quic_version != -1) { 274 if (FLAGS_quic_version != -1) {
275 versions.clear(); 275 versions.clear();
276 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); 276 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version));
277 } 277 }
278 // For secure QUIC we need to verify the cert chain. 278 // For secure QUIC we need to verify the cert chain.
279 scoped_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); 279 std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault());
280 if (line->HasSwitch("disable-certificate-verification")) { 280 if (line->HasSwitch("disable-certificate-verification")) {
281 cert_verifier.reset(new FakeCertVerifier()); 281 cert_verifier.reset(new FakeCertVerifier());
282 } 282 }
283 scoped_ptr<TransportSecurityState> transport_security_state( 283 std::unique_ptr<TransportSecurityState> transport_security_state(
284 new TransportSecurityState); 284 new TransportSecurityState);
285 scoped_ptr<CTVerifier> ct_verifier(new MultiLogCTVerifier()); 285 std::unique_ptr<CTVerifier> ct_verifier(new MultiLogCTVerifier());
286 ProofVerifierChromium* proof_verifier = new ProofVerifierChromium( 286 ProofVerifierChromium* proof_verifier = new ProofVerifierChromium(
287 cert_verifier.get(), nullptr, transport_security_state.get(), 287 cert_verifier.get(), nullptr, transport_security_state.get(),
288 ct_verifier.get()); 288 ct_verifier.get());
289 net::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id, 289 net::QuicSimpleClient client(net::IPEndPoint(ip_addr, port), server_id,
290 versions, proof_verifier); 290 versions, proof_verifier);
291 client.set_initial_max_packet_length( 291 client.set_initial_max_packet_length(
292 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize); 292 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize);
293 if (!client.Initialize()) { 293 if (!client.Initialize()) {
294 cerr << "Failed to initialize client." << endl; 294 cerr << "Failed to initialize client." << endl;
295 return 1; 295 return 1;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 return 0; 387 return 0;
388 } else { 388 } else {
389 cout << "Request failed (redirect " << response_code << ")." << endl; 389 cout << "Request failed (redirect " << response_code << ")." << endl;
390 return 1; 390 return 1;
391 } 391 }
392 } else { 392 } else {
393 cerr << "Request failed (" << response_code << ")." << endl; 393 cerr << "Request failed (" << response_code << ")." << endl;
394 return 1; 394 return 1;
395 } 395 }
396 } 396 }
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_client.cc ('k') | net/tools/quic/quic_simple_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698