Re: PHP 4.0 Bug #8552 Updated: fopen doesn't open URL

From: Date: Thu, 04 Jan 2001 22:12:55 +0000
Subject: Re: PHP 4.0 Bug #8552 Updated: fopen doesn't open URL
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-42992@lists.php.net to get a copy of this message
Hi Stig, I can confirm this behavior on my Win2k box running PHP 4.0.4/IIS fopen ("http://www.yahoo.com/", "r"); // Works fopen ("http://yahoo.com/", "r"); // Fails --zak ----- Original Message ----- From: "Stig Venaas" <Stig.Venaas@uninett.no> To: <mike@newfangled.com> Cc: <php-dev@lists.php.net> Sent: Thursday, January 04, 2001 2:52 PM Subject: Re: [PHP-DEV] PHP 4.0 Bug #8552 Updated: fopen doesn't open URL > I need some input from others here, especially from Windows (2000) users. > > I've been in touch with user, and it seems that fopen fails > on URLs that end with a file, so that > > http://www.mysite.com/index.html > > fails, while > > http://www.mysite.com/ > > works. The first one worked in 4.0.2 but not in 4.0.3. I think the > problem might be with the new regexp in url.c, here's the diff: > > @@ -116,8 +116,8 @@ > > regfree(&re); /* free the old regex */ > > - if ((cerr=regcomp(&re, "^(([^@:]+)(:([^@:]+))?@)?([^:@]+)(:([^:@]+))?", REG_EXTENDED)) > - || (err=regexec(&re, result, 10, subs, 0))) { > + if ((cerr=regcomp(&re, "^(([^@:]+)(:([^@:]+))?@)?((\\[(.*)\\])|([^:@]+))(:([^:@]+))?", REG_EXTENDED)) > + || (err=regexec(&re, result, 11, subs, 0))) { > STR_FREE(ret->scheme); > STR_FREE(ret->path); > STR_FREE(ret->query); > @@ -135,11 +135,13 @@ > if (subs[4].rm_so != -1 && subs[4].rm_so < length) { > ret->pass = estrndup(result + subs[4].rm_so, subs[4].rm_eo - subs[4].rm_so); > } > - if (subs[5].rm_so != -1 && subs[5].rm_so < length) { > - ret->host = estrndup(result + subs[5].rm_so, subs[5].rm_eo - subs[5].rm_so); > - } > if (subs[7].rm_so != -1 && subs[7].rm_so < length) { > - ret->port = (unsigned short) strtol(result + subs[7].rm_so, NULL, 10); > + ret->host = estrndup(result + subs[7].rm_so, subs[7].rm_eo - subs[7].rm_so); > + } else if (subs[8].rm_so != -1 && subs[8].rm_so < length) { > + ret->host = estrndup(result + subs[8].rm_so, subs[8].rm_eo - subs[8].rm_so); > + } > + if (subs[10].rm_so != -1 && subs[10].rm_so < length) { > + ret->port = (unsigned short) strtol(result + subs[10].rm_so, NULL, 10); > } > efree(result); > } > > The code seems to work for most people, but could there be a problem > with this on Windows 2000 Server, Service Pack one? This was tested > with the binaries at php.net. Anyone else with the same release or > at least with Windows have any experiences? > > I first suspected getaddrinfo problems, but getaddrinfo should of course > never be affected by what's in the URL behind the hostport part. > > Stig > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.dev (#42992) next »