cvs: php4 /ext/curl curl.c php_curl.h

From: Date: Thu, 17 Aug 2000 02:14:41 +0000
Subject: cvs: php4 /ext/curl curl.c php_curl.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1200@lists.php.net to get a copy of this message
sterling Wed Aug 16 19:14:41 2000 EDT Modified files: /php4/ext/curl curl.c php_curl.h Log: ts issues. Index: php4/ext/curl/curl.c diff -u php4/ext/curl/curl.c:1.7 php4/ext/curl/curl.c:1.8 --- php4/ext/curl/curl.c:1.7 Tue Aug 15 09:54:48 2000 +++ php4/ext/curl/curl.c Wed Aug 16 19:14:41 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: curl.c,v 1.7 2000/08/15 16:54:48 sterling Exp $ */ +/* $Id: curl.c,v 1.8 2000/08/17 02:14:41 sterling Exp $ */ #include "php.h" @@ -38,8 +38,7 @@ php_curl_globals curl_globals; #endif -/* Basically grabbed from the source code of cURL */ -#ifdef PHP_WIN32 +#if PHP_WIN32 static void win32_cleanup(); static void win32_init(); @@ -86,7 +85,7 @@ curl_functions, PHP_MINIT(curl), PHP_MSHUTDOWN(curl), - PHP_RINIT(curl), + NULL, NULL, PHP_MINFO(curl), STANDARD_MODULE_PROPERTIES @@ -205,15 +204,11 @@ REGISTER_LONG_CONSTANT("CURLE_BAD_CALLING_ORDER", CE_BAD_CALLING_ORDER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("CURL_LAST", C_LAST, CONST_CS | CONST_PERSISTENT); - if (win32_init() != CURLE_OK) - return FAILURE; + win32_init(); - return SUCCESS; -} + CURLG(output_start).next = NULL; -PHP_RINIT_FUNCTION(curl) -{ - CURLG(use_file) = 0; + return SUCCESS; } PHP_MSHUTDOWN_FUNCTION(curl) @@ -316,9 +311,16 @@ ZEND_FETCH_RESOURCE(fp, FILE *, uCurlValue, -1, "File-handle", php_file_le_fopen()); ret = curl_easy_setopt(cp, option, fp); - if (option & CURLOPT_FILE) - CURLG(use_file) = 1; - + if (option == CURLOPT_FILE) { + CURLG(output_node) = &CURLG(output_start); + while (CURLG(output_node)->next) + CURLG(output_node) = CURLG(output_node)->next; + + CURLG(output_node)->next = (struct curl_fileid_table *)emalloc(sizeof(struct curl_fileid_table)); + CURLG(output_node) = CURLG(output_node)->next; + CURLG(output_node)->id = Z_LVAL_PP(uCurlId); + CURLG(output_node)->next = NULL; + } } RETURN_LONG(php_curl_error_translator(ret)); @@ -332,6 +334,7 @@ zval **uCurlId; CURL *cp; CURLcode ret; + int use_file = 0; CURLLS_FETCH(); if (ZEND_NUM_ARGS() != 1 || @@ -340,8 +343,18 @@ } ZEND_FETCH_RESOURCE(cp, CURL *, uCurlId, -1, "CURL Handle", CURLG(le_curl)); + + CURLG(output_node) = CURLG(output_start).next; + while (CURLG(output_node)) + { + if (CURLG(output_node)->id == Z_LVAL_PP(uCurlId)) { + use_file = 1; + break; + } + CURLG(output_node) = CURLG(output_node)->next; + } - if (CURLG(use_file)) { + if (use_file) { ret = curl_easy_perform (cp); } else { FILE *tmp; Index: php4/ext/curl/php_curl.h diff -u php4/ext/curl/php_curl.h:1.6 php4/ext/curl/php_curl.h:1.7 --- php4/ext/curl/php_curl.h:1.6 Tue Aug 15 10:03:48 2000 +++ php4/ext/curl/php_curl.h Wed Aug 16 19:14:41 2000 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_curl.h,v 1.6 2000/08/15 17:03:48 sterling Exp $ */ +/* $Id: php_curl.h,v 1.7 2000/08/17 02:14:41 sterling Exp $ */ #ifndef _PHP_CURL_H #define _PHP_CURL_H @@ -33,7 +33,6 @@ PHP_MINIT_FUNCTION(curl); PHP_MSHUTDOWN_FUNCTION(curl); -PHP_RINIT_FUNCTION(curl); PHP_MINFO_FUNCTION(curl); PHP_FUNCTION(curl_version); PHP_FUNCTION(curl_init); @@ -88,9 +87,16 @@ #define CE_BAD_CALLING_ORDER 44 #define C_LAST 45 +struct curl_fileid_table +{ + int id; + struct curl_fileid_table *next; +}; + typedef struct { int use_file; int le_curl; + struct curl_fileid_table *output_node, output_start; } php_curl_globals; #ifdef ZTS

« previous php.cvs (#1200) next »