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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 port = url.EffectiveIntPort(); | 255 port = url.EffectiveIntPort(); |
256 } | 256 } |
257 if (!net::ParseIPLiteralToNumber(host, &ip_addr)) { | 257 if (!net::ParseIPLiteralToNumber(host, &ip_addr)) { |
258 net::AddressList addresses; | 258 net::AddressList addresses; |
259 int rv = net::tools::SynchronousHostResolver::Resolve(host, &addresses); | 259 int rv = net::tools::SynchronousHostResolver::Resolve(host, &addresses); |
260 if (rv != net::OK) { | 260 if (rv != net::OK) { |
261 LOG(ERROR) << "Unable to resolve '" << host | 261 LOG(ERROR) << "Unable to resolve '" << host |
262 << "' : " << net::ErrorToShortString(rv); | 262 << "' : " << net::ErrorToShortString(rv); |
263 return 1; | 263 return 1; |
264 } | 264 } |
265 ip_addr = addresses[0].address(); | 265 ip_addr = addresses[0].address().bytes(); |
266 } | 266 } |
267 | 267 |
268 string host_port = net::IPAddressToStringWithPort(ip_addr, FLAGS_port); | 268 string host_port = net::IPAddressToStringWithPort(ip_addr, FLAGS_port); |
269 VLOG(1) << "Resolved " << host << " to " << host_port << endl; | 269 VLOG(1) << "Resolved " << host << " to " << host_port << endl; |
270 | 270 |
271 // Build the client, and try to connect. | 271 // Build the client, and try to connect. |
272 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), | 272 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), |
273 net::PRIVACY_MODE_DISABLED); | 273 net::PRIVACY_MODE_DISABLED); |
274 net::QuicVersionVector versions = net::QuicSupportedVersions(); | 274 net::QuicVersionVector versions = net::QuicSupportedVersions(); |
275 if (FLAGS_quic_version != -1) { | 275 if (FLAGS_quic_version != -1) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 return 0; | 388 return 0; |
389 } else { | 389 } else { |
390 cout << "Request failed (redirect " << response_code << ")." << endl; | 390 cout << "Request failed (redirect " << response_code << ")." << endl; |
391 return 1; | 391 return 1; |
392 } | 392 } |
393 } else { | 393 } else { |
394 cerr << "Request failed (" << response_code << ")." << endl; | 394 cerr << "Request failed (" << response_code << ")." << endl; |
395 return 1; | 395 return 1; |
396 } | 396 } |
397 } | 397 } |
OLD | NEW |