cvs: php4(PHP_4_0_7) /ext/standard http_fopen_wrapper.c

From: Date: Tue, 16 Oct 2001 08:55:30 +0000
Subject: cvs: php4(PHP_4_0_7) /ext/standard http_fopen_wrapper.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-7828@lists.php.net to get a copy of this message
edink Tue Oct 16 04:55:30 2001 EDT Modified files: (Branch: PHP_4_0_7) /php4/ext/standard http_fopen_wrapper.c Log: Meged fix for bug #13083 into the release branch. Index: php4/ext/standard/http_fopen_wrapper.c diff -u php4/ext/standard/http_fopen_wrapper.c:1.16 php4/ext/standard/http_fopen_wrapper.c:1.16.2.1 --- php4/ext/standard/http_fopen_wrapper.c:1.16 Tue Jul 31 19:32:24 2001 +++ php4/ext/standard/http_fopen_wrapper.c Tue Oct 16 04:55:30 2001 @@ -17,7 +17,7 @@ | Hartmut Holzgraefe <hholzgra@php.net> | +----------------------------------------------------------------------+ */ -/* $Id: http_fopen_wrapper.c,v 1.16 2001/07/31 23:32:24 zeev Exp $ */ +/* $Id: http_fopen_wrapper.c,v 1.16.2.1 2001/10/16 08:55:30 edink Exp $ */ #include "php.h" #include "php_globals.h" @@ -271,11 +271,28 @@ if (!reqok) { SOCK_FCLOSE(*socketd); *socketd = 0; - php_url_free(resource); if (location[0] != '\0') { zval **response_header_new, *entry, **entryp; + char new_path[512]; - fp = php_fopen_url_wrap_http(location, mode, options, issock, socketd, opened_path TSRMLS_CC); + *new_path='\0'; + if (strlen(location)<8 || strncasecmp(location, "http://", 7)) { + strcpy(new_path, "http://"); + strncat(new_path, resource->host, sizeof(new_path)-strlen(new_path)-1); + if (resource->port != 80) { + snprintf(new_path+strlen(new_path), sizeof(new_path)-strlen(new_path)-1, ":%d", resource->port); + } + if (*location != '/') { + php_dirname(resource->path, strlen(resource->path)); + snprintf (new_path+strlen(new_path), sizeof(new_path)-strlen(new_path)-1, "%s/", resource->path); + } + strncat(new_path, location, sizeof(new_path)-strlen(new_path)-1); + } + else { + strncpy(new_path, location, sizeof(new_path)); + } + php_url_free(resource); + fp = php_fopen_url_wrap_http(new_path, mode, options, issock, socketd, opened_path TSRMLS_CC); if (zend_hash_find(EG(active_symbol_table), "http_response_header", sizeof("http_response_header"), (void **) &response_header_new) == SUCCESS) { entryp = &entry; MAKE_STD_ZVAL(entry); @@ -290,6 +307,7 @@ } goto out; } else { + php_url_free(resource); fp = NULL; goto out; }

« previous php.cvs (#7828) next »