cvs: php4 /main fopen-wrappers.c
| From: | Stig Venaas | Date: | Tue, 05 Sep 2000 15:59:08 +0000 |
| Subject: | cvs: php4 /main fopen-wrappers.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1576@lists.php.net to get a copy of this message | ||
venaas Tue Sep 5 08:59:08 2000 EDT
Modified files:
/php4/main fopen-wrappers.c
Log:
using the new hostconnect() for the http wrapper
Index: php4/main/fopen-wrappers.c
diff -u php4/main/fopen-wrappers.c:1.86 php4/main/fopen-wrappers.c:1.87
--- php4/main/fopen-wrappers.c:1.86 Thu Aug 31 15:23:53 2000
+++ php4/main/fopen-wrappers.c Tue Sep 5 08:59:08 2000
@@ -16,7 +16,7 @@
| Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: fopen-wrappers.c,v 1.86 2000/08/31 22:23:53 andi Exp $ */
+/* $Id: fopen-wrappers.c,v 1.87 2000/09/05 15:59:08 venaas Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -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 @@
{
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 @@
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);