diff options
author | Stig Venaas <venaas@php.net> | 2000-09-05 15:59:08 +0000 |
---|---|---|
committer | Stig Venaas <venaas@php.net> | 2000-09-05 15:59:08 +0000 |
commit | b83427db64b4598462eea646005506e01154d208 (patch) | |
tree | b8cddfd0c5d62a93a765f9af7f43bfab3a51693a | |
parent | 504d44366c57ec90c6a7c37968515085a056ed40 (diff) | |
download | php-git-b83427db64b4598462eea646005506e01154d208.tar.gz |
using the new hostconnect() for the http wrapper
-rw-r--r-- | main/fopen_wrappers.c | 22 |
1 files changed, 3 insertions, 19 deletions
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); |