Re: PHP 4.0 Bug #8552 Updated: fopen doesn't open URL
| From: | Cynic | Date: | Thu, 04 Jan 2001 22:08:20 +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-42990@lists.php.net to get a copy of this message | ||
Stig, I wanted to post a me-too, but have experienced the exact
'No error' warning on my machine at home when I tried to fopen
a file from the same server through http, and don't remember
the version of PHP I have there, so I wanted to wait till
tomorrow, but it seems fopen() works NT 5 Apache/1.3.15-dev
w/ PHP 4.0.4 php4_module.
It might be it's older than 4.0.4 which outputs 'Resource ID # ..'
for calls to both remote servers and the server itself through
http...
At 22:52 4.1. 2001, Stig Venaas wrote the following:
--------------------------------------------------------------
>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
------end of quote------
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz