This will allow handling of http://[fe80::1]:443/foo.html
IPv6 Numeric addressing with port number to parse correctly.
}
/* check for port */
- if ((p = memchr(s, ':', (e-s)))) {
+ /* memrchr is a GNU specific extension
+ Emulate for wide compatability */
+ for(p = e; *p != ':' && p >= s; p--);
+
+ if (*p == ':') {
if (!ret->port) {
p++;
if (e-p > 5) { /* port cannot be longer then 5 characters */
efree(ret);
return NULL;
}
-
+
ret->host = estrndup(s, (p-s));
php_replace_controlchars(ret->host);