PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work
| From: | jimw@php.net | Date: | Tue, 23 Jan 2001 03:19:45 +0000 |
| Subject: | PHP 4.0 Bug #7880 Updated: PHP_URL_FOPEN doesn't work | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-44788@lists.php.net to get a copy of this message | ||
ID: 7880
Updated by: jimw
Reported By: Alan@Halachmi.net
Status: Open
Old-Bug Type: *URL Functions
Bug Type: Network related
Assigned To: jason@php.net
Comments:
reclassifying.
Previous Comments:
---------------------------------------------------------------------------
[2000-12-30 20:52:24] Alan@Halachmi.net
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, '