url-parser: handle ipv6 [] addresses
This commit is contained in:
parent
7832b236a4
commit
a5f2d8b688
1 changed files with 13 additions and 2 deletions
|
@ -1513,8 +1513,19 @@ lws_parse_uri(char *p, const char **prot, const char **ads, int *port,
|
|||
else if (!strcmp(*prot, "https") || !strcmp(*prot, "wss"))
|
||||
*port = 443;
|
||||
|
||||
while (*p && *p != ':' && *p != '/')
|
||||
p++;
|
||||
if (*p == '[')
|
||||
{
|
||||
++(*ads);
|
||||
while (*p && *p != ']')
|
||||
p++;
|
||||
if (*p)
|
||||
*p++ = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*p && *p != ':' && *p != '/')
|
||||
p++;
|
||||
}
|
||||
if (*p == ':') {
|
||||
*p++ = '\0';
|
||||
*port = atoi(p);
|
||||
|
|
Loading…
Add table
Reference in a new issue