From: Michael Wallner Date: Wed, 13 Sep 2006 12:56:56 +0000 (+0000) Subject: - fix typo X-Git-Tag: RELEASE_1_3_0~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=d22651c805eca6f0d508c6d5a47e8daac36841fe;p=m6w6%2Fext-http - fix typo - the global datashare should really use the global handle --- diff --git a/http.c b/http.c index 51d452a..5a0b058 100644 --- a/http.c +++ b/http.c @@ -241,7 +241,7 @@ PHP_INI_BEGIN() #ifdef ZEND_ENGINE_2 HTTP_PHP_INI_ENTRY("http.request.datashare.cookie", "0", PHP_INI_SYSTEM, OnUpdateBool, request.datashare.cookie) HTTP_PHP_INI_ENTRY("http.request.datashare.dns", "0", PHP_INI_SYSTEM, OnUpdateBool, request.datashare.dns) - HTTP_PHP_INI_ENTRY("http.request.datashare.sll", "0", PHP_INI_SYSTEM, OnUpdateBool, request.datashare.ssl) + HTTP_PHP_INI_ENTRY("http.request.datashare.ssl", "0", PHP_INI_SYSTEM, OnUpdateBool, request.datashare.ssl) HTTP_PHP_INI_ENTRY("http.request.datashare.connect", "0", PHP_INI_SYSTEM, OnUpdateBool, request.datashare.connect) #endif #ifdef HTTP_HAVE_ZLIB diff --git a/http_request_datashare_api.c b/http_request_datashare_api.c index 4983377..efcdb84 100644 --- a/http_request_datashare_api.c +++ b/http_request_datashare_api.c @@ -32,6 +32,11 @@ static int http_request_datashare_compare_handles(void *h1, void *h2); static void http_request_datashare_lock_func(CURL *handle, curl_lock_data data, curl_lock_access locktype, void *userptr); static void http_request_datashare_unlock_func(CURL *handle, curl_lock_data data, void *userptr); +http_request_datashare *_http_request_datashare_global_get(void) +{ + return &http_request_datashare_global; +} + PHP_MINIT_FUNCTION(http_request_datashare) { curl_lock_data val; diff --git a/http_requestdatashare_object.c b/http_requestdatashare_object.c index e3872f6..451aefe 100644 --- a/http_requestdatashare_object.c +++ b/http_requestdatashare_object.c @@ -272,7 +272,7 @@ static inline zval *_http_requestdatashare_instantiate(zval *this_ptr, zend_bool if (!this_ptr) { MAKE_STD_ZVAL(this_ptr); Z_TYPE_P(this_ptr) = IS_OBJECT; - this_ptr->value.obj = http_requestdatashare_object_new(http_requestdatashare_object_ce); + this_ptr->value.obj = http_requestdatashare_object_new_ex(http_requestdatashare_object_ce, global ? http_request_datashare_global_get() : NULL, NULL); } if (global) { if (HTTP_G->request.datashare.cookie) { diff --git a/package2.xml b/package2.xml index a5a2935..829948f 100644 --- a/package2.xml +++ b/package2.xml @@ -198,6 +198,7 @@ support. Parallel requests are available for PHP 5 and greater. + diff --git a/php_http_request_datashare_api.h b/php_http_request_datashare_api.h index 179124e..831712f 100644 --- a/php_http_request_datashare_api.h +++ b/php_http_request_datashare_api.h @@ -28,6 +28,9 @@ typedef struct _http_request_datashare_t { http_request_datashare_lock *locks; } http_request_datashare; +#define http_request_datashare_global_get _http_request_datashare_global_get +extern http_request_datashare *_http_request_datashare_global_get(void); + extern PHP_MINIT_FUNCTION(http_request_datashare); extern PHP_MSHUTDOWN_FUNCTION(http_request_datashare); diff --git a/tests/HttpRequestDataShare_002.phpt b/tests/HttpRequestDataShare_002.phpt new file mode 100644 index 0000000..0b2f0ac --- /dev/null +++ b/tests/HttpRequestDataShare_002.phpt @@ -0,0 +1,37 @@ +--TEST-- +HttpRequestDataShare global +--SKIPIF-- + +--INI-- +http.request.datashare.cookie = 1 +--FILE-- +enableCookies(); +$r2->enableCookies(); + +$s->attach($r1); +$s->attach($r2); + +$r1->send(); +$r2->send(); + +$s->reset(); + +var_dump(current($r1->getResponseCookies())->cookies["PREF"] === HttpUtil::parseCookie($r2->getRequestMessage()->getHeader("Cookie"))->cookies["PREF"]); + +echo "Done\n"; +?> +--EXPECTF-- +%sTEST +bool(true) +Done