re-applied fix for GH# 172 which got lost in previous commit

This commit is contained in:
Guenter Obiltschnig
2013-07-18 14:27:59 +02:00
parent ec2d99bf9d
commit 6cfa1f0bbc

View File

@@ -119,7 +119,19 @@ void HTTPRequest::setHost(const std::string& host)
void HTTPRequest::setHost(const std::string& host, Poco::UInt16 port) void HTTPRequest::setHost(const std::string& host, Poco::UInt16 port)
{ {
std::string value(host); std::string value;
if (host.find(':') != std::string::npos)
{
// IPv6 address
value.append("[");
value.append(host);
value.append("]");
}
else
{
value.append(host);
}
if (port != 80 && port != 443) if (port != 80 && port != 443)
{ {
value.append(":"); value.append(":");