Index: net/tools/quic/quic_simple_client_bin.cc |
diff --git a/net/tools/quic/quic_simple_client_bin.cc b/net/tools/quic/quic_simple_client_bin.cc |
index 33f3e997d52ddcccbaa5e1a55dbb0008b3055917..396009290943db575988b4d270cd3ec1687bdb22 100644 |
--- a/net/tools/quic/quic_simple_client_bin.cc |
+++ b/net/tools/quic/quic_simple_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/http_request_info.h" |
@@ -57,6 +59,7 @@ |
#include "net/quic/quic_utils.h" |
#include "net/spdy/spdy_http_utils.h" |
#include "net/tools/quic/quic_simple_client.h" |
+#include "net/tools/quic/synchronous_host_resolver.h" |
#include "url/gurl.h" |
using base::StringPiece; |
@@ -170,14 +173,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); |