Revert "Problem: tcp_address.cpp allowed [ and ] around address"

This reverts commit 78a7b469a1993b681031f513d0c750c3a8454bb8.
This commit is contained in:
Pieter Hintjens 2014-06-25 14:36:55 +02:00
parent ce8fbb26cb
commit 58c067ff0e

View File

@ -413,6 +413,11 @@ int zmq::tcp_address_t::resolve (const char *name_, bool local_, bool ipv6_, boo
std::string addr_str (name_, delimiter - name_);
std::string port_str (delimiter + 1);
// Remove square brackets around the address, if any.
if (addr_str.size () >= 2 && addr_str [0] == '[' &&
addr_str [addr_str.size () - 1] == ']')
addr_str = addr_str.substr (1, addr_str.size () - 2);
// Allow 0 specifically, to detect invalid port error in atoi if not
uint16_t port;
if (port_str == "*" || port_str == "0")