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

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

Issue 1245013003: QUIC - clean up changes to keep internal source and chromium code in sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Protect_against_QUIC_crash_bug_98506577
Patch Set: Merge with TOT Created 5 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/end_to_end_test.cc ('k') | 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 if (line->HasSwitch("redirect_is_success")) { 159 if (line->HasSwitch("redirect_is_success")) {
160 FLAGS_redirect_is_success = true; 160 FLAGS_redirect_is_success = true;
161 } 161 }
162 if (line->HasSwitch("initial_mtu")) { 162 if (line->HasSwitch("initial_mtu")) {
163 if (!base::StringToInt(line->GetSwitchValueASCII("initial_mtu"), 163 if (!base::StringToInt(line->GetSwitchValueASCII("initial_mtu"),
164 &FLAGS_initial_mtu)) { 164 &FLAGS_initial_mtu)) {
165 std::cerr << "--initial_mtu must be an integer\n"; 165 std::cerr << "--initial_mtu must be an integer\n";
166 return 1; 166 return 1;
167 } 167 }
168 } else {
169 // Default and initial maximum size in bytes of a QUIC packet, which is used
170 // to set connection's max_packet_length.
171 FLAGS_initial_mtu = net::kDefaultMaxPacketSize;
172 } 168 }
173 169
174 VLOG(1) << "server host: " << FLAGS_host << " port: " << FLAGS_port 170 VLOG(1) << "server host: " << FLAGS_host << " port: " << FLAGS_port
175 << " body: " << FLAGS_body << " headers: " << FLAGS_headers 171 << " body: " << FLAGS_body << " headers: " << FLAGS_headers
176 << " quiet: " << FLAGS_quiet 172 << " quiet: " << FLAGS_quiet
177 << " quic-version: " << FLAGS_quic_version 173 << " quic-version: " << FLAGS_quic_version
178 << " version_mismatch_ok: " << FLAGS_version_mismatch_ok 174 << " version_mismatch_ok: " << FLAGS_version_mismatch_ok
179 << " redirect_is_success: " << FLAGS_redirect_is_success 175 << " redirect_is_success: " << FLAGS_redirect_is_success
180 << " initial_mtu: " << FLAGS_initial_mtu; 176 << " initial_mtu: " << FLAGS_initial_mtu;
181 177
(...skipping 30 matching lines...) Expand all
212 net::PRIVACY_MODE_DISABLED); 208 net::PRIVACY_MODE_DISABLED);
213 net::QuicVersionVector versions = net::QuicSupportedVersions(); 209 net::QuicVersionVector versions = net::QuicSupportedVersions();
214 if (FLAGS_quic_version != -1) { 210 if (FLAGS_quic_version != -1) {
215 versions.clear(); 211 versions.clear();
216 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); 212 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version));
217 } 213 }
218 net::tools::QuicClient client(net::IPEndPoint(ip_addr, FLAGS_port), server_id, 214 net::tools::QuicClient client(net::IPEndPoint(ip_addr, FLAGS_port), server_id,
219 versions, &epoll_server); 215 versions, &epoll_server);
220 scoped_ptr<CertVerifier> cert_verifier; 216 scoped_ptr<CertVerifier> cert_verifier;
221 scoped_ptr<TransportSecurityState> transport_security_state; 217 scoped_ptr<TransportSecurityState> transport_security_state;
222 if (FLAGS_initial_mtu != 0) { 218 client.set_initial_max_packet_length(
223 client.set_initial_max_packet_length(FLAGS_initial_mtu); 219 FLAGS_initial_mtu != 0 ? FLAGS_initial_mtu : net::kDefaultMaxPacketSize);
224 }
225 if (is_https) { 220 if (is_https) {
226 // For secure QUIC we need to verify the cert chain.a 221 // For secure QUIC we need to verify the cert chain.
227 cert_verifier.reset(CertVerifier::CreateDefault()); 222 cert_verifier.reset(CertVerifier::CreateDefault());
228 transport_security_state.reset(new TransportSecurityState); 223 transport_security_state.reset(new TransportSecurityState);
229 client.SetProofVerifier(new ProofVerifierChromium( 224 client.SetProofVerifier(new ProofVerifierChromium(
230 cert_verifier.get(), transport_security_state.get())); 225 cert_verifier.get(), transport_security_state.get()));
231 } 226 }
232 if (!client.Initialize()) { 227 if (!client.Initialize()) {
233 cerr << "Failed to initialize client." << endl; 228 cerr << "Failed to initialize client." << endl;
234 return 1; 229 return 1;
235 } 230 }
236 if (!client.Connect()) { 231 if (!client.Connect()) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 return 0; 299 return 0;
305 } else { 300 } else {
306 cout << "Request failed (redirect " << response_code << ")." << endl; 301 cout << "Request failed (redirect " << response_code << ")." << endl;
307 return 1; 302 return 1;
308 } 303 }
309 } else { 304 } else {
310 cerr << "Request failed (" << response_code << ")." << endl; 305 cerr << "Request failed (" << response_code << ")." << endl;
311 return 1; 306 return 1;
312 } 307 }
313 } 308 }
OLDNEW
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_simple_client_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698