Skip to content

Commit

Permalink
Accept square bracket notation for IPv6 addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
jow- committed Apr 17, 2013
1 parent 9d83bd3 commit d518cb3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ static int add_listener_arg(char *arg, bool tls)
char *host = NULL;
char *port = arg;
char *s;
int l;

s = strrchr(arg, ':');
if (s) {
Expand All @@ -111,6 +112,14 @@ static int add_listener_arg(char *arg, bool tls)
*s = 0;
}

if (host && *host == '[') {
l = strlen(host);
if (l >= 2) {
host[l-1] = 0;
host++;
}
}

return uh_socket_bind(host, port, tls);
}

Expand Down

0 comments on commit d518cb3

Please sign in to comment.