summaryrefslogtreecommitdiffstats
path: root/net/tools/quic/quic_client_bin.cc
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-08 19:00:49 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-08 19:00:49 +0000
commit00016895fdcf0a081d812369c13ae5b9a9f7f04f (patch)
tree07978355d42a9abf283e25aad55bf599b5fabea3 /net/tools/quic/quic_client_bin.cc
parent083808accb22adb1ac7e832a855666215d050525 (diff)
downloadchromium_src-00016895fdcf0a081d812369c13ae5b9a9f7f04f.zip
chromium_src-00016895fdcf0a081d812369c13ae5b9a9f7f04f.tar.gz
chromium_src-00016895fdcf0a081d812369c13ae5b9a9f7f04f.tar.bz2
Add better help information to quic_client and quic_server.
Also, modify the quic_client to print out the response contents. Merge internal change: 53403247 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=227365 Review URL: https://codereview.chromium.org/25043005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227558 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools/quic/quic_client_bin.cc')
-rw-r--r--net/tools/quic/quic_client_bin.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/net/tools/quic/quic_client_bin.cc b/net/tools/quic/quic_client_bin.cc
index e13bea5..5591b87 100644
--- a/net/tools/quic/quic_client_bin.cc
+++ b/net/tools/quic/quic_client_bin.cc
@@ -2,11 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// A binary wrapper for QuicClient. Connects to --hostname or --address on
-// --port and requests URLs specified on the command line.
+// A binary wrapper for QuicClient. Connects to --hostname via --address
+// on --port and requests URLs specified on the command line.
//
// For example:
-// quic_client --port=6122 /index.html /favicon.ico
+// quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com
+// http://www.google.com/index.html http://www.google.com/favicon.ico
+
+#include <iostream>
#include "base/at_exit.h"
#include "base/command_line.h"
@@ -23,6 +26,18 @@ std::string FLAGS_hostname = "localhost";
int main(int argc, char *argv[]) {
CommandLine::Init(argc, argv);
CommandLine* line = CommandLine::ForCurrentProcess();
+ if (line->HasSwitch("h") || line->HasSwitch("help")) {
+ const char* help_str =
+ "Usage: quic_client [options]\n"
+ "\n"
+ "Options:\n"
+ "-h, --help show this help message and exit\n"
+ "--port=<port> specify the port to connect to\n"
+ "--address=<address> specify the IP address to connect to\n"
+ "--host=<host> specify the SNI hostname to use\n";
+ std::cout << help_str;
+ exit(0);
+ }
if (line->HasSwitch("port")) {
int port;
if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) {
@@ -44,8 +59,8 @@ int main(int argc, char *argv[]) {
net::IPAddressNumber addr;
CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr));
// TODO(rjshade): Set version on command line.
- net::tools::QuicClient client(
- net::IPEndPoint(addr, FLAGS_port), FLAGS_hostname, net::QuicVersionMax());
+ net::tools::QuicClient client(net::IPEndPoint(addr, FLAGS_port),
+ FLAGS_hostname, net::QuicVersionMax(), true);
client.Initialize();