Bug #7880 Updated: PHP_URL_FOPEN doesn't work
| From: | jason@php.net | Date: | Wed, 04 Jul 2001 18:53:52 +0000 |
| Subject: | Bug #7880 Updated: PHP_URL_FOPEN doesn't work | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-58910@lists.php.net to get a copy of this message | ||
ID: 7880
Updated by: jason
Reported By: Alan@Halachmi.net
Old-Status: Assigned
Status: Closed
Bug Type: Network related
Operating system:
PHP Version: 4.0.3pl1
Assigned To: jason@php.net
Comments:
Never able to reproduce, try 4.0.6 and reopen if still a problem.
Previous Comments:
---------------------------------------------------------------------------
[2001-01-22 22:19:45] jimw@php.net
reclassifying.
---------------------------------------------------------------------------
[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, '