| OLD | NEW |
| 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 // | 8 // |
| 9 // For example: | 9 // For example: |
| 10 // quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com | 10 // quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com |
| 11 // http://www.google.com/index.html http://www.google.com/favicon.ico | 11 // http://www.google.com/index.html http://www.google.com/favicon.ico |
| 12 | 12 |
| 13 #include <iostream> | 13 #include <iostream> |
| 14 | 14 |
| 15 #include "base/at_exit.h" | 15 #include "base/at_exit.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
| 20 #include "net/base/privacy_mode.h" |
| 20 #include "net/quic/quic_protocol.h" | 21 #include "net/quic/quic_protocol.h" |
| 21 #include "net/tools/quic/quic_client.h" | 22 #include "net/tools/quic/quic_client.h" |
| 22 | 23 |
| 23 int32 FLAGS_port = 6121; | 24 int32 FLAGS_port = 6121; |
| 24 std::string FLAGS_address = "127.0.0.1"; | 25 std::string FLAGS_address = "127.0.0.1"; |
| 25 std::string FLAGS_hostname = "localhost"; | 26 std::string FLAGS_hostname = "localhost"; |
| 26 bool FLAGS_secure = false; | 27 bool FLAGS_secure = false; |
| 27 | 28 |
| 28 int main(int argc, char *argv[]) { | 29 int main(int argc, char *argv[]) { |
| 29 CommandLine::Init(argc, argv); | 30 CommandLine::Init(argc, argv); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 << " hostname: " << FLAGS_hostname | 67 << " hostname: " << FLAGS_hostname |
| 67 << " secure: " << FLAGS_secure; | 68 << " secure: " << FLAGS_secure; |
| 68 | 69 |
| 69 base::AtExitManager exit_manager; | 70 base::AtExitManager exit_manager; |
| 70 | 71 |
| 71 net::IPAddressNumber addr; | 72 net::IPAddressNumber addr; |
| 72 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); | 73 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); |
| 73 // TODO(rjshade): Set version on command line. | 74 // TODO(rjshade): Set version on command line. |
| 74 net::tools::QuicClient client( | 75 net::tools::QuicClient client( |
| 75 net::IPEndPoint(addr, FLAGS_port), | 76 net::IPEndPoint(addr, FLAGS_port), |
| 76 net::QuicSessionKey(FLAGS_hostname, FLAGS_port, FLAGS_secure), | 77 net::QuicSessionKey(FLAGS_hostname, FLAGS_port, FLAGS_secure, |
| 78 net::kPrivacyModeDisabled), |
| 77 net::QuicSupportedVersions(), true); | 79 net::QuicSupportedVersions(), true); |
| 78 | 80 |
| 79 client.Initialize(); | 81 client.Initialize(); |
| 80 | 82 |
| 81 if (!client.Connect()) return 1; | 83 if (!client.Connect()) return 1; |
| 82 | 84 |
| 83 client.SendRequestsAndWaitForResponse(line->GetArgs()); | 85 client.SendRequestsAndWaitForResponse(line->GetArgs()); |
| 84 return 0; | 86 return 0; |
| 85 } | 87 } |
| OLD | NEW |