From 8069575838e4f189d8492125a882e1de52709596 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 15 Feb 2012 00:14:27 +0900 Subject: [PATCH] Enclose host in [] if host is IPv6 literal address. --- examples/spdycat.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/spdycat.cc b/examples/spdycat.cc index cde82197..b433958e 100644 --- a/examples/spdycat.cc +++ b/examples/spdycat.cc @@ -161,7 +161,14 @@ int communicate(const std::string& host, uint16_t port, pollfd pollfds[1]; std::stringstream ss; - ss << host << ":" << port; + if(reqvec[0].us.ipv6LiteralAddress) { + ss << "["; + } + ss << host; + if(reqvec[0].us.ipv6LiteralAddress) { + ss << "]"; + } + ss << ":" << port; std::string hostport = ss.str(); for(int i = 0, n = reqvec.size(); i < n; ++i) {