X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fpersistent_handles_002.phpt;fp=tests%2Fpersistent_handles_002.phpt;h=6efa9cbfaecc71d0c0fe8cb129e929bf6d519bb6;hb=f25310e793f05996d99ac7476cc1f2437e5bfb0e;hp=0000000000000000000000000000000000000000;hpb=b7afdab5771258952d6ea517332c49e02769b2d9;p=m6w6%2Fext-http diff --git a/tests/persistent_handles_002.phpt b/tests/persistent_handles_002.phpt new file mode 100644 index 0000000..6efa9cb --- /dev/null +++ b/tests/persistent_handles_002.phpt @@ -0,0 +1,81 @@ +--TEST-- +persistent handles +--SKIPIF-- + +--INI-- +http.persistent.handles.limit=-1 +http.persistent.handles.ident=GLOBAL +--FILE-- + $idents) { + foreach ((array)$idents as $ident => $counts) { + if (!empty($counts["free"])) { + printf("%s, %s, %s\n", $provider, $ident, $counts["free"]); + } + } +} + +http_get("http://www.google.com/", null, $info[]); + +echo "One free request handle within GLOBAL: "; +var_dump(http_persistent_handles_count()->http_request["GLOBAL"]["free"]); + +echo "Reusing request handle: "; +http_get("http://www.google.com/", null, $info[]); +var_dump($info[0]["pretransfer_time"] > 10 * $info[1]["pretransfer_time"], $info[0]["pretransfer_time"], $info[1]["pretransfer_time"]); + +echo "Handles' been cleaned up:\n"; +http_persistent_handles_clean(); +print_r(http_persistent_handles_count()); + +echo "Done\n"; +?> +--EXPECTF-- +%sTEST +No free handles! +One free request handle within GLOBAL: int(1) +Reusing request handle: bool(true) +float(%f) +float(%f) +Handles' been cleaned up: +stdClass Object +( + [http_request] => Array + ( + [GLOBAL] => Array + ( + [used] => 0 + [free] => 0 + ) + + ) + + [http_request_datashare] => Array + ( + [GLOBAL] => Array + ( + [used] => 0 + [free] => 0 + ) + + ) + + [http_request_pool] => Array + ( + [GLOBAL] => Array + ( + [used] => 0 + [free] => 0 + ) + + ) + +) +Done