From: Michael Wallner Date: Wed, 26 Sep 2007 15:35:20 +0000 (+0000) Subject: - more fixes, additions X-Git-Tag: RELEASE_1_5_6~7 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=18bea31ac491d8d38e6b1ff6845a9930cda8d195;p=m6w6%2Fext-http - more fixes, additions --- diff --git a/tests/HttpRequestPool_005.phpt b/tests/HttpRequestPool_005.phpt index a36299a..b08729e 100644 --- a/tests/HttpRequestPool_005.phpt +++ b/tests/HttpRequestPool_005.phpt @@ -34,13 +34,13 @@ echo "Done\n"; %sTEST HttpRequestPoolException: Exception caused by 2 inner exception(s) HttpInvalidParamException: Empty or too short HTTP message: '' - HttpRequestException: couldn't resolve host name; Couldn't resolve host '_____' (http://_____/) + HttpRequestException: %souldn't resolve host name; %s (http://_____/) int(3) HttpRequestPoolException: Exception caused by 4 inner exception(s) HttpInvalidParamException: Empty or too short HTTP message: '' - HttpRequestException: couldn't resolve host name; Couldn't resolve host '_____' (http://_____/) + HttpRequestException: %souldn't resolve host name; %s (http://_____/) HttpInvalidParamException: Empty or too short HTTP message: '' - HttpRequestException: couldn't resolve host name; Couldn't resolve host '_____' (http://_____/) + HttpRequestException: %souldn't resolve host name; %s (http://_____/) int(5) Done diff --git a/tests/HttpRequest_004.phpt b/tests/HttpRequest_004.phpt index dd710f0..948a07e 100644 --- a/tests/HttpRequest_004.phpt +++ b/tests/HttpRequest_004.phpt @@ -42,7 +42,7 @@ echo "Done\n"; %sTEST First Request -string(149) "Array +string(%d) "Array ( [int] => 1 [dbl] => 3.1415926535898 @@ -69,7 +69,7 @@ array(2) { } Second Request -string(285) "Array +string(%d) "Array ( [0] => Array ( @@ -104,7 +104,7 @@ array(2) { } Third Request -string(302) "Array +string(%d) "Array ( [0] => Array ( diff --git a/tests/persistent_handles_002.phpt b/tests/persistent_handles_002.phpt new file mode 100644 index 0000000..fb4c8fa --- /dev/null +++ b/tests/persistent_handles_002.phpt @@ -0,0 +1,83 @@ +--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 + ) + + ) + + [http_request_datashare] => Array + ( + [GLOBAL] => Array + ( + [used] => 0 + [free] => 0 + ) + + ) + + [http_request_pool] => Array + ( + [GLOBAL] => Array + ( + [used] => 0 + [free] => 0 + ) + + ) + +) +Done 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 diff --git a/tests/send_file_006.phpt b/tests/send_file_006.phpt index e778805..925473e 100644 --- a/tests/send_file_006.phpt +++ b/tests/send_file_006.phpt @@ -4,6 +4,7 @@ http_send_file() first/last byte range --ENV-- HTTP_RANGE=bytes=0-0,-1 diff --git a/tests/send_file_007.phpt b/tests/send_file_007.phpt index 1ee12cc..47c4b24 100644 --- a/tests/send_file_007.phpt +++ b/tests/send_file_007.phpt @@ -4,6 +4,7 @@ http_send_file() NIL-NIL range --ENV-- HTTP_RANGE=bytes=0-0