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

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

Issue 466513002: Check that user has supplied at least one URL argument to quic_client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename args to urls Created 6 years, 4 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 | 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. Connects to --hostname via --address 5 // A binary wrapper for QuicClient. Connects to --hostname via --address
6 // on --port and requests URLs specified on the command line. 6 // on --port and requests URLs specified on the command line.
7 // Pass --secure to check the certificates using proof verifier. 7 // Pass --secure to check the certificates using proof verifier.
8 // Pass --initial_stream_flow_control_window to specify the size of the initial 8 // Pass --initial_stream_flow_control_window to specify the size of the initial
9 // stream flow control receive window to advertise to server. 9 // stream flow control receive window to advertise to server.
10 // Pass --initial_session_flow_control_window to specify the size of the initial 10 // Pass --initial_session_flow_control_window to specify the size of the initial
(...skipping 26 matching lines...) Expand all
37 int32 FLAGS_initial_stream_flow_control_window = 100 * net::kMaxPacketSize; 37 int32 FLAGS_initial_stream_flow_control_window = 100 * net::kMaxPacketSize;
38 // Size of the initial session flow control receive window to advertise to 38 // Size of the initial session flow control receive window to advertise to
39 // server. 39 // server.
40 int32 FLAGS_initial_session_flow_control_window = 200 * net::kMaxPacketSize; 40 int32 FLAGS_initial_session_flow_control_window = 200 * net::kMaxPacketSize;
41 // Check the certificates using proof verifier. 41 // Check the certificates using proof verifier.
42 bool FLAGS_secure = false; 42 bool FLAGS_secure = false;
43 43
44 int main(int argc, char *argv[]) { 44 int main(int argc, char *argv[]) {
45 base::CommandLine::Init(argc, argv); 45 base::CommandLine::Init(argc, argv);
46 base::CommandLine* line = base::CommandLine::ForCurrentProcess(); 46 base::CommandLine* line = base::CommandLine::ForCurrentProcess();
47 const base::CommandLine::StringVector& urls = line->GetArgs();
47 48
48 logging::LoggingSettings settings; 49 logging::LoggingSettings settings;
49 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 50 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
50 CHECK(logging::InitLogging(settings)); 51 CHECK(logging::InitLogging(settings));
51 52
52 if (line->HasSwitch("h") || line->HasSwitch("help")) { 53 if (line->HasSwitch("h") || line->HasSwitch("help") || urls.empty()) {
53 const char* help_str = 54 const char* help_str =
54 "Usage: quic_client [options]\n" 55 "Usage: quic_client [options] <url> ...\n"
55 "\n" 56 "\n"
57 "At least one <url> with scheme must be provided "
58 "(e.g. http://www.google.com/)\n\n"
56 "Options:\n" 59 "Options:\n"
57 "-h, --help show this help message and exit\n" 60 "-h, --help show this help message and exit\n"
58 "--port=<port> specify the port to connect to\n" 61 "--port=<port> specify the port to connect to\n"
59 "--address=<address> specify the IP address to connect to\n" 62 "--address=<address> specify the IP address to connect to\n"
60 "--host=<host> specify the SNI hostname to use\n" 63 "--host=<host> specify the SNI hostname to use\n"
61 "--secure check certificates\n"; 64 "--secure check certificates\n";
62 std::cout << help_str; 65 std::cout << help_str;
63 exit(0); 66 exit(0);
64 } 67 }
65 if (line->HasSwitch("port")) { 68 if (line->HasSwitch("port")) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 net::tools::QuicClient client( 104 net::tools::QuicClient client(
102 net::IPEndPoint(addr, FLAGS_port), 105 net::IPEndPoint(addr, FLAGS_port),
103 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, 106 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure,
104 net::PRIVACY_MODE_DISABLED), 107 net::PRIVACY_MODE_DISABLED),
105 net::QuicSupportedVersions(), true, config, &epoll_server); 108 net::QuicSupportedVersions(), true, config, &epoll_server);
106 109
107 client.Initialize(); 110 client.Initialize();
108 111
109 if (!client.Connect()) return 1; 112 if (!client.Connect()) return 1;
110 113
111 client.SendRequestsAndWaitForResponse(line->GetArgs()); 114 client.SendRequestsAndWaitForResponse(urls);
112 return 0; 115 return 0;
113 } 116 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698