HttpProxyOptionHandler: Enclose hostname with square brackets if

hostname is IPv6 numeric address.
pull/2/head
Tatsuhiro Tsujikawa 2011-10-15 23:10:00 +09:00
parent 2d6e087f58
commit 065fb3a6b8
1 changed files with 6 additions and 1 deletions

View File

@ -697,7 +697,12 @@ void HttpProxyOptionHandler::parseArg(Option& option, const std::string& optarg)
if(uri.size() > 7) {
uri += "@";
}
strappend(uri, req.getHost(), A2STR::COLON_C, util::uitos(req.getPort()));
if(req.isIPv6LiteralAddress()) {
strappend(uri, "[", req.getHost(), "]");
} else {
uri += req.getHost();
}
strappend(uri, A2STR::COLON_C, util::uitos(req.getPort()));
option.put(optName_, uri);
}
}