cvs: php4(php_4_0_4) /ext/curl curl.c

From: Date: Thu, 07 Dec 2000 11:07:40 +0000
Subject: cvs: php4(php_4_0_4) /ext/curl curl.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-2998@lists.php.net to get a copy of this message
sniper Thu Dec 7 03:07:40 2000 EDT Branch: php_4_0_4 Modified files: /php4/ext/curl curl.c Log: Merge changes from HEAD. Index: php4/ext/curl/curl.c diff -u php4/ext/curl/curl.c:1.29 php4/ext/curl/curl.c:1.29.2.1 --- php4/ext/curl/curl.c:1.29 Thu Nov 23 08:31:58 2000 +++ php4/ext/curl/curl.c Thu Dec 7 03:07:40 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: curl.c,v 1.29 2000/11/23 16:31:58 sniper Exp $ */ +/* $Id: curl.c,v 1.29.2.1 2000/12/07 11:07:40 sniper Exp $ */ #include "php.h" @@ -146,6 +146,7 @@ REGISTER_LONG_CONSTANT("CURLOPT_PROXY", CURLOPT_PROXY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CURLOPT_VERBOSE", CURLOPT_VERBOSE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CURLOPT_HEADER", CURLOPT_HEADER, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("CURLOPT_HTTPHEADER", CURLOPT_HEADER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CURLOPT_NOPROGRESS", CURLOPT_NOPROGRESS, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CURLOPT_NOBODY", CURLOPT_NOBODY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CURLOPT_FAILONERROR", CURLOPT_FAILONERROR, CONST_CS | CONST_PERSISTENT); @@ -300,7 +301,7 @@ } memset(curl_handle, 0, sizeof(php_curl)); - zend_llist_init(&curl_handle->to_free,sizeof(char *),curl_free_string,0); + zend_llist_init(&curl_handle->to_free, sizeof(char *), curl_free_string, 0); curl_handle->cp = curl_easy_init(); if (!curl_handle->cp) { @@ -576,7 +577,8 @@ CURLcode ret; FILE *fp; char buf[4096]; - int b; + int b, + is_temp_file; unsigned long pos = 0; if (ZEND_NUM_ARGS() != 1 || @@ -595,6 +597,8 @@ } curl_easy_setopt(curl_handle->cp, CURLOPT_FILE, fp); + + is_temp_file = 1; } else if (curl_handle->return_transfer && curl_handle->output_file) { @@ -614,6 +618,9 @@ } else { RETURN_TRUE; } + + if (fp && is_temp_file) + fclose(fp); } @@ -625,6 +632,9 @@ php_write(buf, b); } + if (is_temp_file) + fclose(fp); + } else { char *ret_data; @@ -641,6 +651,9 @@ pos += b; } ret_data[stat_sb.st_size - 1] = '\0'; + + if (is_temp_file) + fclose(fp); RETURN_STRINGL(ret_data, stat_sb.st_size, 0);

« previous php.cvs (#2998) next »