From: Michael Wallner Date: Fri, 12 Jul 2019 12:25:19 +0000 (+0200) Subject: add more cookie tests X-Git-Tag: RELEASE_3_2_2~14 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=e2b947ae9fa3b56f94855c5c111ccc9fb595d460;p=m6w6%2Fext-http add more cookie tests --- diff --git a/BUGS b/BUGS index 4c2ad80..62a1511 100644 --- a/BUGS +++ b/BUGS @@ -1,25 +1,6 @@ Known Issues ============ -Windows: - If you keep getting "SSL connect error" when trying to issue - requests, try another (newer) libeay32.dll/ssleay32.dll pair. +## libcurl-7.64.1 -Internals: - Inflating raw deflated data causes a re-initialization of the inflate - stream where the corresponding window bits are modified to tell libz - to not check for zlib header bytes. This is not preventable AFAICS. - LFS dependant parts of libcurl are left out because of off_t, - respectively off64_t confusion. - Persistent handles and "cookiestore" request option do interfere, - as libcurl saves the cookies to the file on curl_easy_destroy(), - cookies are not saved until the CURL handle will be recycled. - Thus one would either need to - * run PHP with raphf.persistent_handles.limit = 0 - * call raphf\persistent_handles_clean() every request - * call $client->flushCookies(), which is available - since libcurl v7.17.1 and does not work with the - procedural API - HTTP and Proxy authentication information (username/password) can not be - unset with NULL prior libcurl v7.19.6 and separate options for setting - username and password--which work--are only available since v7.19.6. +Superfluous output of "* Closing connection #" on STDERR. \ No newline at end of file diff --git a/src/php_http_client_curl.c b/src/php_http_client_curl.c index 45515fa..389464b 100644 --- a/src/php_http_client_curl.c +++ b/src/php_http_client_curl.c @@ -2075,7 +2075,9 @@ static void php_http_client_curl_handler_clear(php_http_client_curl_handler_t *h curl_easy_setopt(handler->handle, CURLOPT_COOKIELIST, "FLUSH"); curl_easy_setopt(handler->handle, CURLOPT_SHARE, NULL); /* see gh issue #84 */ - curl_easy_setopt(handler->handle, CURLOPT_COOKIEJAR, NULL); + //if (php_http_curle_get_storage(handler->handle)->cookiestore) { + //curl_easy_setopt(handler->handle, CURLOPT_COOKIEJAR, NULL); + //} } static void php_http_client_curl_handler_dtor(php_http_client_curl_handler_t *handler) diff --git a/tests/client031.phpt b/tests/client031.phpt new file mode 100644 index 0000000..3211735 --- /dev/null +++ b/tests/client031.phpt @@ -0,0 +1,71 @@ +--TEST-- +client cookie sharing disabled +--SKIPIF-- + +--FILE-- +configure(array("share_cookies" => false)); + $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + while (($r = $client->getResponse())) { + dump_headers(null, $r->getHeaders()); + } + /* requeue the previous request */ + $client->requeue($request); + $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + while (($r = $client->getResponse())) { + dump_headers(null, $r->getHeaders()); + } + $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + while (($r = $client->getResponse())) { + dump_headers(null, $r->getHeaders()); + } + $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + while (($r = $client->getResponse())) { + dump_headers(null, $r->getHeaders()); + } +}); + +?> +===DONE=== +--EXPECTF-- +Test +Etag: "" +Set-Cookie: counter=1; +X-Original-Transfer-Encoding: chunked + +Etag: "" +Set-Cookie: counter=1; +X-Original-Transfer-Encoding: chunked + +Etag: "" +Set-Cookie: counter=2; +X-Original-Transfer-Encoding: chunked + +Etag: "" +Set-Cookie: counter=1; +X-Original-Transfer-Encoding: chunked + +Etag: "" +Set-Cookie: counter=1; +X-Original-Transfer-Encoding: chunked + +===DONE=== diff --git a/tests/client032.phpt b/tests/client032.phpt new file mode 100644 index 0000000..d8dfb2b --- /dev/null +++ b/tests/client032.phpt @@ -0,0 +1,71 @@ +--TEST-- +client cookie sharing enabled +--SKIPIF-- + +--FILE-- +configure(array("share_cookies" => true)); + $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + while (($r = $client->getResponse())) { + dump_headers(null, $r->getHeaders()); + } + /* requeue the previous request */ + $client->requeue($request); + $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + while (($r = $client->getResponse())) { + dump_headers(null, $r->getHeaders()); + } + $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + while (($r = $client->getResponse())) { + dump_headers(null, $r->getHeaders()); + } + $request = new http\Client\Request("GET", "http://localhost:$port"); + $client->enqueue($request); + $client->send(); + while (($r = $client->getResponse())) { + dump_headers(null, $r->getHeaders()); + } +}); + +?> +===DONE=== +--EXPECTF-- +Test +Etag: "" +Set-Cookie: counter=1; +X-Original-Transfer-Encoding: chunked + +Etag: "" +Set-Cookie: counter=2; +X-Original-Transfer-Encoding: chunked + +Etag: "" +Set-Cookie: counter=2; +X-Original-Transfer-Encoding: chunked + +Etag: "" +Set-Cookie: counter=3; +X-Original-Transfer-Encoding: chunked + +Etag: "" +Set-Cookie: counter=4; +X-Original-Transfer-Encoding: chunked + +===DONE===