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