diff options
author | Sara Golemon <pollita@php.net> | 2003-12-15 06:54:31 +0000 |
---|---|---|
committer | Sara Golemon <pollita@php.net> | 2003-12-15 06:54:31 +0000 |
commit | e90f85e45da5e80bd8fa5d40070ed4de034d59ad (patch) | |
tree | ce0bfccaf8a35369f32ec0bd1ff35d3c2b10c88b | |
parent | c3043fb2e4ca55a83e8686621590695b9d61c674 (diff) | |
download | php-git-e90f85e45da5e80bd8fa5d40070ed4de034d59ad.tar.gz |
Scan for : in host:port pair from right instead of left.
This will allow handling of http://[fe80::1]:443/foo.html
IPv6 Numeric addressing with port number to parse correctly.
-rw-r--r-- | ext/standard/url.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/standard/url.c b/ext/standard/url.c index 1996bb574c..3c30e2407d 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -200,7 +200,11 @@ PHPAPI php_url *php_url_parse(char *str) } /* 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 */ @@ -228,7 +232,7 @@ PHPAPI php_url *php_url_parse(char *str) efree(ret); return NULL; } - + ret->host = estrndup(s, (p-s)); php_replace_controlchars(ret->host); |