]> granicus.if.org Git - php/commitdiff
MFH
authorIlia Alshanetsky <iliaa@php.net>
Mon, 30 Dec 2002 16:43:31 +0000 (16:43 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 30 Dec 2002 16:43:31 +0000 (16:43 +0000)
ext/standard/tests/strings/url_t.phpt
ext/standard/url.c

index 78cf2bbeeb63dccf21e417c105075f4fde578088..78a6706f5416a0f2638870dcb1eedc8c0bcb3f24 100644 (file)
@@ -63,7 +63,8 @@ $sample_urls = array (
 'foo://foo@bar',
 'mailto:me@mydomain.com',
 '/foo.php?a=b&c=d',
-'foo.php?a=b&c=d'
+'foo.php?a=b&c=d',
+'http://user:passwd@www.example.com:8080?bar=1&boom=0'
 );
 
     foreach ($sample_urls as $url) {
@@ -601,3 +602,17 @@ array(2) {
   ["query"]=>
   string(7) "a=b&c=d"
 }
+array(6) {
+  ["scheme"]=>
+  string(4) "http"
+  ["host"]=>
+  string(15) "www.example.com"
+  ["port"]=>
+  int(8080)
+  ["user"]=>
+  string(4) "user"
+  ["pass"]=>
+  string(6) "passwd"
+  ["query"]=>
+  string(12) "bar=1&boom=0"
+}
index d59f6139cb012337c2b22d262aedb1a9c69caa43..be91dffdb0cb31f53a9c97111a95aa8db39c87c1 100644 (file)
@@ -157,12 +157,16 @@ PHPAPI php_url *php_url_parse(char *str)
                goto nohost;
        }
        
-       if (!(e = strchr(s, '/'))) {
-               e = ue;
-       } else if (e && e == s) {
-               e = ue;
-       }
-
+       e = ue;
+       
+       if (!(p = strchr(s, '/'))) {
+               if ((p = strchr(s, '?'))) {
+                       e = p;
+               }
+       } else {
+               e = p;
+       }       
+               
        /* check for login and password */
        if ((p = memchr(s, '@', (e-s)))) {
                if ((pp = memchr(s, ':', (p-s)))) {