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

Side by Side Diff: net/tools/quic/quic_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_client_base.h ('k') | net/tools/quic/quic_client_session.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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // Build the client, and try to connect. 268 // Build the client, and try to connect.
269 net::EpollServer epoll_server; 269 net::EpollServer epoll_server;
270 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), 270 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(),
271 net::PRIVACY_MODE_DISABLED); 271 net::PRIVACY_MODE_DISABLED);
272 net::QuicVersionVector versions = net::QuicSupportedVersions(); 272 net::QuicVersionVector versions = net::QuicSupportedVersions();
273 if (FLAGS_quic_version != -1) { 273 if (FLAGS_quic_version != -1) {
274 versions.clear(); 274 versions.clear();
275 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); 275 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version));
276 } 276 }
277 // For secure QUIC we need to verify the cert chain. 277 // For secure QUIC we need to verify the cert chain.
278 scoped_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault()); 278 std::unique_ptr<CertVerifier> cert_verifier(CertVerifier::CreateDefault());
279 if (line->HasSwitch("disable-certificate-verification")) { 279 if (line->HasSwitch("disable-certificate-verification")) {
280 cert_verifier.reset(new FakeCertVerifier()); 280 cert_verifier.reset(new FakeCertVerifier());
281 } 281 }
282 scoped_ptr<TransportSecurityState> transport_security_state( 282 std::unique_ptr<TransportSecurityState> transport_security_state(
283 new TransportSecurityState); 283 new TransportSecurityState);
284 transport_security_state.reset(new TransportSecurityState); 284 transport_security_state.reset(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::QuicClient client(net::IPEndPoint(ip_addr, FLAGS_port), server_id, 289 net::QuicClient client(net::IPEndPoint(ip_addr, FLAGS_port), server_id,
290 versions, &epoll_server, proof_verifier); 290 versions, &epoll_server, 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 return 0; 386 return 0;
387 } else { 387 } else {
388 cout << "Request failed (redirect " << response_code << ")." << endl; 388 cout << "Request failed (redirect " << response_code << ")." << endl;
389 return 1; 389 return 1;
390 } 390 }
391 } else { 391 } else {
392 cerr << "Request failed (" << response_code << ")." << endl; 392 cerr << "Request failed (" << response_code << ")." << endl;
393 return 1; 393 return 1;
394 } 394 }
395 } 395 }
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client_base.h ('k') | net/tools/quic/quic_client_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698