Commit 15f9ee19 authored by Constantin Rack's avatar Constantin Rack

Solution: allow brackets in tcp ipv6 address

parent d33fb6a2
......@@ -717,11 +717,12 @@ int zmq::socket_base_t::connect (const char *addr_)
// Following code is quick and dirty check to catch obvious errors,
// without trying to be fully accurate.
const char *check = address.c_str ();
if (isalnum (*check) || isxdigit (*check)) {
if (isalnum (*check) || isxdigit (*check) || *check == '[') {
check++;
while (isalnum (*check)
|| isxdigit (*check)
|| *check == '.' || *check == '-' || *check == ':'|| *check == ';')
|| *check == '.' || *check == '-' || *check == ':'|| *check == ';'
|| *check == ']')
check++;
}
// Assume the worst, now look for success
......
......@@ -40,7 +40,10 @@ int main (void)
int rc = zmq_connect (sock, "tcp://localhost:1234");
assert (rc == 0);
rc = zmq_connect (sock, "tcp://[::1]:1234");
assert (rc == 0);
rc = zmq_connect (sock, "tcp://localhost:invalid");
assert (rc == -1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment