| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 int rv = net::SynchronousHostResolver::Resolve(host, &addresses); | 238 int rv = net::SynchronousHostResolver::Resolve(host, &addresses); |
| 239 if (rv != net::OK) { | 239 if (rv != net::OK) { |
| 240 LOG(ERROR) << "Unable to resolve '" << host | 240 LOG(ERROR) << "Unable to resolve '" << host |
| 241 << "' : " << net::ErrorToShortString(rv); | 241 << "' : " << net::ErrorToShortString(rv); |
| 242 return 1; | 242 return 1; |
| 243 } | 243 } |
| 244 ip_addr = | 244 ip_addr = |
| 245 net::QuicIpAddress(net::QuicIpAddressImpl(addresses[0].address())); | 245 net::QuicIpAddress(net::QuicIpAddressImpl(addresses[0].address())); |
| 246 } | 246 } |
| 247 | 247 |
| 248 string host_port = | 248 string host_port = net::QuicStrCat(ip_addr.ToString(), ":", port); |
| 249 base::StringPrintf("%s:%d", ip_addr.ToString().c_str(), port); | |
| 250 VLOG(1) << "Resolved " << host << " to " << host_port << endl; | 249 VLOG(1) << "Resolved " << host << " to " << host_port << endl; |
| 251 | 250 |
| 252 // Build the client, and try to connect. | 251 // Build the client, and try to connect. |
| 253 net::EpollServer epoll_server; | 252 net::EpollServer epoll_server; |
| 254 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), | 253 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), |
| 255 net::PRIVACY_MODE_DISABLED); | 254 net::PRIVACY_MODE_DISABLED); |
| 256 net::QuicVersionVector versions = net::AllSupportedVersions(); | 255 net::QuicVersionVector versions = net::AllSupportedVersions(); |
| 257 if (FLAGS_quic_version != -1) { | 256 if (FLAGS_quic_version != -1) { |
| 258 versions.clear(); | 257 versions.clear(); |
| 259 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); | 258 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 return 0; | 367 return 0; |
| 369 } else { | 368 } else { |
| 370 cout << "Request failed (redirect " << response_code << ")." << endl; | 369 cout << "Request failed (redirect " << response_code << ")." << endl; |
| 371 return 1; | 370 return 1; |
| 372 } | 371 } |
| 373 } else { | 372 } else { |
| 374 cerr << "Request failed (" << response_code << ")." << endl; | 373 cerr << "Request failed (" << response_code << ")." << endl; |
| 375 return 1; | 374 return 1; |
| 376 } | 375 } |
| 377 } | 376 } |
| OLD | NEW |