summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSterling Hughes <sterling@php.net>2000-08-17 02:14:41 +0000
committerSterling Hughes <sterling@php.net>2000-08-17 02:14:41 +0000
commit8a8b5dacc6f09ba573842d1a7730b1fdf41190c3 (patch)
treea4721bc3e2048055310c649a972932b006aeea18 /ext
parent80612a97ebb68fad9c975fd1e6e216cca6de1c3a (diff)
downloadphp-git-8a8b5dacc6f09ba573842d1a7730b1fdf41190c3.tar.gz
ts issues.
Diffstat (limited to 'ext')
-rw-r--r--ext/curl/curl.c41
-rw-r--r--ext/curl/php_curl.h8
2 files changed, 34 insertions, 15 deletions
diff --git a/ext/curl/curl.c b/ext/curl/curl.c
index 0748027f90..724dccf744 100644
--- a/ext/curl/curl.c
+++ b/ext/curl/curl.c
@@ -38,8 +38,7 @@ int curl_globals_id;
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 @@ zend_module_entry curl_module_entry = {
curl_functions,
PHP_MINIT(curl),
PHP_MSHUTDOWN(curl),
- PHP_RINIT(curl),
+ NULL,
NULL,
PHP_MINFO(curl),
STANDARD_MODULE_PROPERTIES
@@ -205,15 +204,11 @@ PHP_MINIT_FUNCTION(curl)
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 @@ PHP_FUNCTION(curl_setopt)
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 @@ PHP_FUNCTION (curl_exec)
zval **uCurlId;
CURL *cp;
CURLcode ret;
+ int use_file = 0;
CURLLS_FETCH();
if (ZEND_NUM_ARGS() != 1 ||
@@ -341,7 +344,17 @@ PHP_FUNCTION (curl_exec)
ZEND_FETCH_RESOURCE(cp, CURL *, uCurlId, -1, "CURL Handle", CURLG(le_curl));
- if (CURLG(use_file)) {
+ 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 (use_file) {
ret = curl_easy_perform (cp);
} else {
FILE *tmp;
diff --git a/ext/curl/php_curl.h b/ext/curl/php_curl.h
index 4d42cd3888..5ad041507b 100644
--- a/ext/curl/php_curl.h
+++ b/ext/curl/php_curl.h
@@ -33,7 +33,6 @@ extern zend_module_entry curl_module_entry;
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 @@ PHP_FUNCTION(curl_close);
#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