Re: cvs: docweb /include lib_url_entities.inc.php
| From: | Vincent Gevers | Date: | Sun, 23 Jan 2005 16:26:55 +0000 |
| Subject: | Re: cvs: docweb /include lib_url_entities.inc.php | ||
| References: | 1 2 | Groups: | php.doc.web |
| Request: | Send a blank email to doc-web+get-544@lists.php.net to get a copy of this message | ||
On Sunday 23 January 2005 16:53, Nuno Lopes wrote:
> > vincent Sun Jan 23 08:54:43 2005 EDT
> >
> > Modified files:
> > /docweb/include lib_url_entities.inc.php
> > Log:
> > mainly fix the problem with the openldap.org servers
> > there ipv6 address points to another server then the ipv4 address.
> > I know this is not the correct way (ftp vhosts) but it works for now
> >
> >
> >
> > http://cvs.php.net/diff.php/docweb/include/lib_url_entities.inc.php?r1=1.
> >5&r2=1.6&ty=u Index: docweb/include/lib_url_entities.inc.php
> > diff -u docweb/include/lib_url_entities.inc.php:1.5
> > docweb/include/lib_url_entities.inc.php:1.6
> > --- docweb/include/lib_url_entities.inc.php:1.5 Sat Jan 22 15:44:56 2005
> > +++ docweb/include/lib_url_entities.inc.php Sun Jan 23 08:54:43 2005
> > @@ -19,7 +19,7 @@
> >
> > | Mehdi Achour <didou@php.net> |
> > | Sean Coates <sean@php.net> |
> >
> > +----------------------------------------------------------------------+
> > -$Id: lib_url_entities.inc.php,v 1.5 2005/01/22 20:44:56 sean Exp $
> > +$Id: lib_url_entities.inc.php,v 1.6 2005/01/23 13:54:43 vincent Exp $
> > */
> >
> > // user agent
> > @@ -145,7 +145,8 @@
> > }
> >
> > // Try to find host
> > - if (gethostbyname($url['host']) == $url['host']) {
> > + $url['ip'] = gethostbyname($url['host']);
> > + if ($url['ip'] == $url['host']) {
> > return array(UNKNOWN_HOST, array($num));
> > }
> >
> > @@ -220,7 +221,7 @@
> > break;
> >
> > case 'ftp':
> > - if ($ftp = @ftp_connect($url['host'])) {
> > + if ($ftp = ftp_connect($url['ip'])) {
> >
> > if (@ftp_login($ftp, 'anonymous', 'IEUser@')) {
> > $flist = ftp_nlist($ftp, $url['path']);
>
> Sorry for my ignorance, but what problem are you trying to fix?
> ftp_connect() resolves hosts to IPs, so whats the problem?
It's quite simple actually..
dig AAAA ftp.openldap.org
ftp.openldap.org. 3600 IN CNAME www.openldap.org.
www.openldap.org. 3600 IN AAAA
2001:4f8:3:ba:2e0:18ff:fe02:efec
$ php -r
"var_dump(gethostbyname(gethostbyaddr('2001:4f8:3:ba:2e0:18ff:fe02:efec')));"
string(14) "204.152.186.50"
$ php -r "var_dump(gethostbyname('ftp.openldap.org'));"
string(14) "204.152.186.57"
my system and php tries to use ipv6, which is not strange these days, and
therefor tried to connect to 204.152.186.50, which will return false for the
ftp_connect() call.
my browser will only work with ipv4, making it connect to 204.152.186.57,
which works fine.. and seems to work fine for others too.
I've ran the script on the three supported global.ent files, and none is
giving ftp connect errors.
Vincent
>
> Nuno