X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2Fpersistent_handles_003.phpt;fp=tests%2Fpersistent_handles_003.phpt;h=30158358d1eec98faa5b42cea1a1fef8fa75b623;hp=0000000000000000000000000000000000000000;hb=2296badf107bded5e8ca4d45fdd8ef0f6e5b1d5b;hpb=da1843cf6d0047c118dd052520c2fba230e7f10f diff --git a/tests/persistent_handles_003.phpt b/tests/persistent_handles_003.phpt new file mode 100644 index 0000000..3015835 --- /dev/null +++ b/tests/persistent_handles_003.phpt @@ -0,0 +1,62 @@ +--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: "; +$h = http_persistent_handles_count(); +var_dump($h->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 + ) + + ) + +) +Done