X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2Fpersistent_handles_001.phpt;h=8bdba2504882fff416b858ee717f8bcb1aaef4b7;hp=f5a630970228129dd48578d8f8348e08c33f32c0;hb=e29a410679b63b8f96b6890d1418f39d9ed489cc;hpb=3dcb9b41f2cb451d858c31f2f080c070f0a78762 diff --git a/tests/persistent_handles_001.phpt b/tests/persistent_handles_001.phpt index f5a6309..8bdba25 100644 --- a/tests/persistent_handles_001.phpt +++ b/tests/persistent_handles_001.phpt @@ -3,65 +3,89 @@ 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:\n"; -var_dump(http_persistent_handles_count()->http_request["GLOBAL"]); -echo "Reusing request handle:\n"; + +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"] > 100 * $info[1]["pretransfer_time"], $info[0]["pretransfer_time"], $info[1]["pretransfer_time"]); +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(); -var_dump(http_persistent_handles_count()); +http_persistent_handles_clean(); +print_r(http_persistent_handles_count()); + echo "Done\n"; ?> --EXPECTF-- %sTEST -No free handles: -object(stdClass)#%d (%d) { - ["http_request_pool"]=> - array(0) { - } - ["http_request"]=> - array(0) { - } - ["http_request_datashare"]=> - array(0) { - } - ["http_request_datashare_lock"]=> - array(0) { - } -} -One free request handle within GLOBAL: -int(1) -Reusing request handle: -bool(true) +No free handles! +One free request handle within GLOBAL: int(1) +Reusing request handle: bool(true) float(%f) float(%f) Handles' been cleaned up: -object(stdClass)#%d (%d) { - ["http_request_pool"]=> - array(0) { - } - ["http_request"]=> - array(1) { - ["GLOBAL"]=> - int(1) - } - ["http_request_datashare"]=> - array(0) { - } - ["http_request_datashare_lock"]=> - array(0) { - } -} +stdClass Object +( + [http_request] => Array + ( + [GLOBAL] => Array + ( + [used] => 0 + [free] => 0 + ) + + ) + + [http_request_datashare] => Array + ( + [GLOBAL] => Array + ( + [used] => 0 + [free] => 0 + ) + + ) + + [http_request_datashare_lock] => Array + ( + [GLOBAL] => Array + ( + [used] => 0 + [free] => 0 + ) + + ) + + [http_request_pool] => Array + ( + [GLOBAL] => Array + ( + [used] => 0 + [free] => 0 + ) + + ) + +) Done