[PHP-DEV] Bug #7880 Updated: PHP_URL_FOPEN doesn't work From: jason <email protected>
Date: 07/04/01

ID: 7880
Updated by: jason
Reported By: Alan <email protected>
Old-Status: Assigned
Status: Closed
Bug Type: Network related
Operating system:
PHP Version: 4.0.3pl1
Assigned To: jason <email protected>
Comments:

Never able to reproduce, try 4.0.6 and reopen if still a problem.

Previous Comments:
---------------------------------------------------------------------------

[2001-01-22 22:19:45] jimw <email protected>

reclassifying.

---------------------------------------------------------------------------

[2000-12-30 20:52:24] Alan <email protected>

Ok - I seem to have tracked this down. I added debug statements throughout
PHP to see exactly where it was failing, and found that it is happening in:
php_network_getaddresses in main/network.c. Basically, in
php_fopen_url_wrap_http in ext/standard/http_fopen_wrapper.c, I modified the
function to let me know where it was bailing:

*socketd = php_hostconnect(resource->host, resource->port, SOCK_STREAM, 0);
    if (*socketd == -1) {
        php_error(E_WARNING, "php_hostconnect failed");
        SOCK_FCLOSE(*socketd);
        *socketd = 0;
        free_url(resource);
        return NULL;
    }

It does get to that php_error message, and so after looking through
php_hostconnect, I found that our problem was a failed lookup in
php_network_getaddresses. Here is my slightly modified code that prints out
an error message when getaddrinfo fails:
static int php_network_getaddresses(const char *host, struct sockaddr
***sal)
{
  int err;
  struct sockaddr **sap;

  if (host != NULL) {
#ifdef HAVE_GETADDRINFO
    struct addrinfo hints, *res, *sai;
    int n;

    memset( &hints, '

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>