| Index: net/tools/quic/quic_client_bin.cc
|
| diff --git a/net/tools/quic/quic_client_bin.cc b/net/tools/quic/quic_client_bin.cc
|
| index 259111f8782dd6e2e94c74c3c35d5238c24fe0cb..752ccd8cd9ac49b5b7d67fe9056b03b62b3f5888 100644
|
| --- a/net/tools/quic/quic_client_bin.cc
|
| +++ b/net/tools/quic/quic_client_bin.cc
|
| @@ -47,6 +47,8 @@
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/string_util.h"
|
| #include "net/base/ip_endpoint.h"
|
| +#include "net/base/net_errors.h"
|
| +#include "net/base/net_log.h"
|
| #include "net/base/privacy_mode.h"
|
| #include "net/cert/cert_verifier.h"
|
| #include "net/http/transport_security_state.h"
|
| @@ -57,6 +59,7 @@
|
| #include "net/tools/epoll_server/epoll_server.h"
|
| #include "net/tools/quic/quic_client.h"
|
| #include "net/tools/quic/spdy_utils.h"
|
| +#include "net/tools/quic/synchronous_host_resolver.h"
|
| #include "url/gurl.h"
|
|
|
| using base::StringPiece;
|
| @@ -169,14 +172,18 @@ int main(int argc, char *argv[]) {
|
| // protocol is required in the URL.
|
| GURL url(urls[0]);
|
| string host = FLAGS_host;
|
| - // TODO(rtenneti): get ip_addr from hostname by doing host resolution.
|
| if (host.empty()) {
|
| - LOG(ERROR) << "--host must be specified\n";
|
| - return 1;
|
| + host = url.host();
|
| }
|
| if (!net::ParseIPLiteralToNumber(host, &ip_addr)) {
|
| - LOG(ERROR) << "--host could not be parsed as an IP address\n";
|
| - return 1;
|
| + net::AddressList addresses;
|
| + int rv = net::tools::SynchronousHostResolver::Resolve(host, &addresses);
|
| + if (rv != net::OK) {
|
| + LOG(ERROR) << "Unable to resolve '" << host << "' : "
|
| + << net::ErrorToString(rv);
|
| + return 1;
|
| + }
|
| + ip_addr = addresses[0].address();
|
| }
|
|
|
| string host_port = net::IPAddressToStringWithPort(ip_addr, FLAGS_port);
|
|
|