<email>mike@php.net</email>
<active>yes</active>
</lead>
- <date>2013-08-20</date>
+ <date>2013-11-15</date>
<version>
- <release>1.0.2</release>
+ <release>1.0.3</release>
<api>1.0.0</api>
</version>
<stability>
</stability>
<license>BSD, revised</license>
<notes><![CDATA[
-* Fixed ZTS shutdown crash
+* Added pecl/http-v2 tests
]]></notes>
<contents>
<dir name="/">
<file role="src" name="config.m4" />
<file role="src" name="php_raphf.h" />
<file role="src" name="php_raphf.c" />
+ <dir name="tests">
+ <file role="test" name="http001.phpt" />
+ <file role="test" name="http002.phpt" />
+ <file role="test" name="http003.phpt" />
+ <file role="test" name="http004.phpt" />
+ </dir>
</dir>
</contents>
<dependencies>
--- /dev/null
+--TEST--
+pecl/http-v2 - general and stat
+--SKIPIF--
+<?php
+if (!extension_loaded("http")) {
+ die("skip pecl/http needed");
+}
+if (!class_exists("http\\Client", false)) {
+ die("skip pecl/http-v2 with curl support needed");
+}
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+var_dump(raphf\stat_persistent_handles());
+
+$c = new http\Client("curl", "php.net:80");
+do {
+ $c->enqueue(new http\Client\Request("GET", "http://php.net"));
+} while (count($c) < 3);
+
+var_dump(raphf\stat_persistent_handles());
+
+unset($c);
+
+var_dump(raphf\stat_persistent_handles());
+
+?>
+Done
+--EXPECTF--
+Test
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(0) {
+ }
+ ["http\Client\Curl\Request"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(1)
+ ["free"]=>
+ int(0)
+ }
+ }
+ ["http\Client\Curl\Request"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(3)
+ ["free"]=>
+ int(0)
+ }
+ }
+}
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(0)
+ ["free"]=>
+ int(1)
+ }
+ }
+ ["http\Client\Curl\Request"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(0)
+ ["free"]=>
+ int(3)
+ }
+ }
+}
+Done
--- /dev/null
+--TEST--
+pecl/http-v2 - clean with name and id
+--SKIPIF--
+<?php
+if (!extension_loaded("http")) {
+ die("skip pecl/http needed");
+}
+if (!class_exists("http\\Client", false)) {
+ die("skip pecl/http-v2 with curl support needed");
+}
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+$c = new http\Client("curl", "php.net:80");
+do {
+ $c->enqueue(new http\Client\Request("GET", "http://php.net"));
+} while (count($c) < 3);
+
+unset($c);
+
+var_dump(raphf\stat_persistent_handles());
+
+raphf\clean_persistent_handles("http\\Client\\Curl");
+raphf\clean_persistent_handles("http\\Client\\Curl\\Request", "php.net:80");
+
+var_dump(raphf\stat_persistent_handles());
+
+?>
+Done
+--EXPECTF--
+Test
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(0)
+ ["free"]=>
+ int(1)
+ }
+ }
+ ["http\Client\Curl\Request"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(0)
+ ["free"]=>
+ int(3)
+ }
+ }
+}
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(0) {
+ }
+ ["http\Client\Curl\Request"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(0)
+ ["free"]=>
+ int(0)
+ }
+ }
+}
+Done
--- /dev/null
+--TEST--
+pecl/http-v2 - clean with id only
+--SKIPIF--
+<?php
+if (!extension_loaded("http")) {
+ die("skip pecl/http needed");
+}
+if (!class_exists("http\\Client", false)) {
+ die("skip pecl/http-v2 with curl support needed");
+}
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+$c = new http\Client("curl", "php.net:80");
+do {
+ $c->enqueue(new http\Client\Request("GET", "http://php.net"));
+} while (count($c) < 3);
+
+unset($c);
+
+var_dump(raphf\stat_persistent_handles());
+
+raphf\clean_persistent_handles(null, "php.net:80");
+
+var_dump(raphf\stat_persistent_handles());
+
+?>
+Done
+--EXPECTF--
+Test
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(0)
+ ["free"]=>
+ int(1)
+ }
+ }
+ ["http\Client\Curl\Request"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(0)
+ ["free"]=>
+ int(3)
+ }
+ }
+}
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(0)
+ ["free"]=>
+ int(0)
+ }
+ }
+ ["http\Client\Curl\Request"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(0)
+ ["free"]=>
+ int(0)
+ }
+ }
+}
+Done
--- /dev/null
+--TEST--
+pecl/http-v2 - partial clean
+--SKIPIF--
+<?php
+if (!extension_loaded("http")) {
+ die("skip pecl/http needed");
+}
+if (!class_exists("http\\Client", false)) {
+ die("skip pecl/http-v2 with curl support needed");
+}
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+var_dump(raphf\stat_persistent_handles());
+
+$c = new http\Client("curl", "php.net:80");
+$c2 = new http\Client("curl", "php.net:80");
+do {
+ $c->enqueue(new http\Client\Request("GET", "http://php.net"));
+ $c2->enqueue(new http\Client\Request("GET", "http://php.net"));
+} while (count($c) < 3);
+
+var_dump(raphf\stat_persistent_handles());
+
+unset($c);
+
+var_dump(raphf\stat_persistent_handles());
+
+raphf\clean_persistent_handles();
+
+var_dump(raphf\stat_persistent_handles());
+
+?>
+Done
+--EXPECTF--
+Test
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(0) {
+ }
+ ["http\Client\Curl\Request"]=>
+ array(0) {
+ }
+}
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(2)
+ ["free"]=>
+ int(0)
+ }
+ }
+ ["http\Client\Curl\Request"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(6)
+ ["free"]=>
+ int(0)
+ }
+ }
+}
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(1)
+ ["free"]=>
+ int(1)
+ }
+ }
+ ["http\Client\Curl\Request"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(3)
+ ["free"]=>
+ int(3)
+ }
+ }
+}
+object(stdClass)#%d (2) {
+ ["http\Client\Curl"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(1)
+ ["free"]=>
+ int(0)
+ }
+ }
+ ["http\Client\Curl\Request"]=>
+ array(1) {
+ ["php.net:80"]=>
+ array(2) {
+ ["used"]=>
+ int(3)
+ ["free"]=>
+ int(0)
+ }
+ }
+}
+Done