#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
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;
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) {
<file role="test" name="HttpRequest_009.phpt"/>
<file role="test" name="HttpRequest_010.phpt"/>
<file role="test" name="HttpRequestDataShare_001.phpt"/>
+ <file role="test" name="HttpRequestDataShare_002.phpt"/>
<file role="test" name="HttpRequestPool_001.phpt"/>
<file role="test" name="HttpRequestPool_002.phpt"/>
<file role="test" name="HttpRequestPool_003.phpt"/>
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);
--- /dev/null
+--TEST--
+HttpRequestDataShare global
+--SKIPIF--
+<?php
+include "skip.inc";
+checkcls("HttpRequestDataShare");
+?>
+--INI--
+http.request.datashare.cookie = 1
+--FILE--
+<?php
+echo "-TEST\n";
+
+$s = HttpRequestDataShare::singleton(true);
+
+$r1 = new HttpRequest("http://www.google.com/");
+$r2 = new HttpRequest("http://www.google.com/");
+
+$r1->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