From: Stig Venaas Date: Tue, 5 Sep 2000 15:59:08 +0000 (+0000) Subject: using the new hostconnect() for the http wrapper X-Git-Tag: php-4.0.3RC1~300 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b83427db64b4598462eea646005506e01154d208;p=php using the new hostconnect() for the http wrapper --- diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index fa7c053f4b..a9472b68bf 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -42,6 +42,7 @@ #include "ext/standard/head.h" #include "ext/standard/php_standard.h" #include "zend_compile.h" +#include "php_network.h" #if HAVE_PWD_H #ifdef PHP_WIN32 @@ -476,7 +477,6 @@ static FILE *php_fopen_url_wrap_http(const char *path, char *mode, int options, { FILE *fp=NULL; php_url *resource=NULL; - struct sockaddr_in server; char tmp_line[512]; char location[512]; char hdr_line[8192]; @@ -496,24 +496,8 @@ static FILE *php_fopen_url_wrap_http(const char *path, char *mode, int options, if (resource->port == 0) resource->port = 80; - *socketd = socket(AF_INET, SOCK_STREAM, 0); - if (*socketd == SOCK_ERR) { - SOCK_FCLOSE(*socketd); - *socketd = 0; - free_url(resource); - return NULL; - } - server.sin_family = AF_INET; - - if (lookup_hostname(resource->host, &server.sin_addr)) { - SOCK_FCLOSE(*socketd); - *socketd = 0; - free_url(resource); - return NULL; - } - server.sin_port = htons(resource->port); - - if (connect(*socketd, (struct sockaddr *) &server, sizeof(server)) == SOCK_CONN_ERR) { + *socketd = hostconnect(resource->host, resource->port, SOCK_STREAM, 0); + if (*socketd == -1) { SOCK_FCLOSE(*socketd); *socketd = 0; free_url(resource);