Skip to content

Commit 6cfa1f0

Browse files
committed
re-applied fix for GH# 172 which got lost in previous commit
1 parent ec2d99b commit 6cfa1f0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Net/src/HTTPRequest.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,19 @@ void HTTPRequest::setHost(const std::string& host)
119119

120120
void HTTPRequest::setHost(const std::string& host, Poco::UInt16 port)
121121
{
122-
std::string value(host);
122+
std::string value;
123+
if (host.find(':') != std::string::npos)
124+
{
125+
// IPv6 address
126+
value.append("[");
127+
value.append(host);
128+
value.append("]");
129+
}
130+
else
131+
{
132+
value.append(host);
133+
}
134+
123135
if (port != 80 && port != 443)
124136
{
125137
value.append(":");

0 commit comments

Comments
 (0)