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

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

Issue 19858003: * Removed QuicTag kQuicVersion1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments from rch Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/quic_client.cc ('k') | net/tools/quic/quic_dispatcher.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. Connects to --hostname or --address on 5 // A binary wrapper for QuicClient. Connects to --hostname or --address on
6 // --port and requests URLs specified on the command line. 6 // --port and requests URLs specified on the command line.
7 // 7 //
8 // For example: 8 // For example:
9 // quic_client --port=6122 /index.html /favicon.ico 9 // quic_client --port=6122 /index.html /favicon.ico
10 10
11 #include "base/at_exit.h" 11 #include "base/at_exit.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "net/base/ip_endpoint.h" 15 #include "net/base/ip_endpoint.h"
16 #include "net/quic/quic_protocol.h"
16 #include "net/tools/quic/quic_client.h" 17 #include "net/tools/quic/quic_client.h"
17 18
18 int32 FLAGS_port = 6121; 19 int32 FLAGS_port = 6121;
19 std::string FLAGS_address = "127.0.0.1"; 20 std::string FLAGS_address = "127.0.0.1";
20 std::string FLAGS_hostname = "localhost"; 21 std::string FLAGS_hostname = "localhost";
21 22
22 int main(int argc, char *argv[]) { 23 int main(int argc, char *argv[]) {
23 CommandLine::Init(argc, argv); 24 CommandLine::Init(argc, argv);
24 CommandLine* line = CommandLine::ForCurrentProcess(); 25 CommandLine* line = CommandLine::ForCurrentProcess();
25 if (line->HasSwitch("port")) { 26 if (line->HasSwitch("port")) {
26 int port; 27 int port;
27 if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) { 28 if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) {
28 FLAGS_port = port; 29 FLAGS_port = port;
29 } 30 }
30 } 31 }
31 if (line->HasSwitch("address")) { 32 if (line->HasSwitch("address")) {
32 FLAGS_address = line->GetSwitchValueASCII("address"); 33 FLAGS_address = line->GetSwitchValueASCII("address");
33 } 34 }
34 if (line->HasSwitch("hostname")) { 35 if (line->HasSwitch("hostname")) {
35 FLAGS_hostname = line->GetSwitchValueASCII("hostname"); 36 FLAGS_hostname = line->GetSwitchValueASCII("hostname");
36 } 37 }
37 LOG(INFO) << "server port: " << FLAGS_port 38 LOG(INFO) << "server port: " << FLAGS_port
38 << " address: " << FLAGS_address 39 << " address: " << FLAGS_address
39 << " hostname: " << FLAGS_hostname; 40 << " hostname: " << FLAGS_hostname;
40 41
41 base::AtExitManager exit_manager; 42 base::AtExitManager exit_manager;
42 43
43 net::IPAddressNumber addr; 44 net::IPAddressNumber addr;
44 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); 45 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr));
46 // TODO(rjshade): Set version on command line.
45 net::tools::QuicClient client( 47 net::tools::QuicClient client(
46 net::IPEndPoint(addr, FLAGS_port), FLAGS_hostname); 48 net::IPEndPoint(addr, FLAGS_port), FLAGS_hostname, net::QuicVersionMax());
47 49
48 client.Initialize(); 50 client.Initialize();
49 51
50 if (!client.Connect()) return 1; 52 if (!client.Connect()) return 1;
51 53
52 client.SendRequestsAndWaitForResponse(line->GetArgs()); 54 client.SendRequestsAndWaitForResponse(line->GetArgs());
53 return 0; 55 return 0;
54 } 56 }
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.cc ('k') | net/tools/quic/quic_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698