fixed GH# 172: IPv6 Host field is stripped of Brackets in HTTPClientSession

This commit is contained in:
Guenter Obiltschnig
2013-05-24 21:08:10 +02:00
parent ab85e7077f
commit 94ee8fa76e
3 changed files with 32 additions and 5 deletions

View File

@@ -118,7 +118,19 @@ void HTTPRequest::setHost(const std::string& host)
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)
{
value.append(":");