| 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. | 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "base/strings/string_split.h" | 48 #include "base/strings/string_split.h" |
| 49 #include "base/strings/string_util.h" | 49 #include "base/strings/string_util.h" |
| 50 #include "net/base/ip_endpoint.h" | 50 #include "net/base/ip_endpoint.h" |
| 51 #include "net/base/net_errors.h" | 51 #include "net/base/net_errors.h" |
| 52 #include "net/base/privacy_mode.h" | 52 #include "net/base/privacy_mode.h" |
| 53 #include "net/cert/cert_verifier.h" | 53 #include "net/cert/cert_verifier.h" |
| 54 #include "net/cert/multi_log_ct_verifier.h" | 54 #include "net/cert/multi_log_ct_verifier.h" |
| 55 #include "net/http/transport_security_state.h" | 55 #include "net/http/transport_security_state.h" |
| 56 #include "net/log/net_log.h" | 56 #include "net/log/net_log.h" |
| 57 #include "net/quic/crypto/proof_verifier_chromium.h" | 57 #include "net/quic/crypto/proof_verifier_chromium.h" |
| 58 #include "net/quic/quic_flags.h" |
| 58 #include "net/quic/quic_protocol.h" | 59 #include "net/quic/quic_protocol.h" |
| 59 #include "net/quic/quic_server_id.h" | 60 #include "net/quic/quic_server_id.h" |
| 60 #include "net/quic/quic_utils.h" | 61 #include "net/quic/quic_utils.h" |
| 61 #include "net/spdy/spdy_header_block.h" | 62 #include "net/spdy/spdy_header_block.h" |
| 62 #include "net/tools/epoll_server/epoll_server.h" | 63 #include "net/tools/epoll_server/epoll_server.h" |
| 63 #include "net/tools/quic/quic_client.h" | 64 #include "net/tools/quic/quic_client.h" |
| 64 #include "net/tools/quic/spdy_balsa_utils.h" | 65 #include "net/tools/quic/spdy_balsa_utils.h" |
| 65 #include "net/tools/quic/synchronous_host_resolver.h" | 66 #include "net/tools/quic/synchronous_host_resolver.h" |
| 66 #include "url/gurl.h" | 67 #include "url/gurl.h" |
| 67 | 68 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 120 |
| 120 int main(int argc, char *argv[]) { | 121 int main(int argc, char *argv[]) { |
| 121 base::CommandLine::Init(argc, argv); | 122 base::CommandLine::Init(argc, argv); |
| 122 base::CommandLine* line = base::CommandLine::ForCurrentProcess(); | 123 base::CommandLine* line = base::CommandLine::ForCurrentProcess(); |
| 123 const base::CommandLine::StringVector& urls = line->GetArgs(); | 124 const base::CommandLine::StringVector& urls = line->GetArgs(); |
| 124 | 125 |
| 125 logging::LoggingSettings settings; | 126 logging::LoggingSettings settings; |
| 126 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 127 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 127 CHECK(logging::InitLogging(settings)); | 128 CHECK(logging::InitLogging(settings)); |
| 128 | 129 |
| 130 FLAGS_quic_supports_trailers = true; |
| 131 |
| 129 if (line->HasSwitch("h") || line->HasSwitch("help") || urls.empty()) { | 132 if (line->HasSwitch("h") || line->HasSwitch("help") || urls.empty()) { |
| 130 const char* help_str = | 133 const char* help_str = |
| 131 "Usage: quic_client [options] <url>\n" | 134 "Usage: quic_client [options] <url>\n" |
| 132 "\n" | 135 "\n" |
| 133 "<url> with scheme must be provided (e.g. http://www.google.com)\n\n" | 136 "<url> with scheme must be provided (e.g. http://www.google.com)\n\n" |
| 134 "Options:\n" | 137 "Options:\n" |
| 135 "-h, --help show this help message and exit\n" | 138 "-h, --help show this help message and exit\n" |
| 136 "--host=<host> specify the IP address of the hostname to " | 139 "--host=<host> specify the IP address of the hostname to " |
| 137 "connect to\n" | 140 "connect to\n" |
| 138 "--port=<port> specify the port to connect to\n" | 141 "--port=<port> specify the port to connect to\n" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return 0; | 327 return 0; |
| 325 } else { | 328 } else { |
| 326 cout << "Request failed (redirect " << response_code << ")." << endl; | 329 cout << "Request failed (redirect " << response_code << ")." << endl; |
| 327 return 1; | 330 return 1; |
| 328 } | 331 } |
| 329 } else { | 332 } else { |
| 330 cerr << "Request failed (" << response_code << ")." << endl; | 333 cerr << "Request failed (" << response_code << ")." << endl; |
| 331 return 1; | 334 return 1; |
| 332 } | 335 } |
| 333 } | 336 } |
| OLD | NEW |