- libevent diagnostics
[m6w6/ext-http] / tests / persistent_handles_001.phpt
1 --TEST--
2 persistent handles
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 skipif(!http_support(HTTP_SUPPORT_REQUESTS), "need request support");
7 ?>
8 --INI--
9 http.persistent.handles.limit=-1
10 http.persistent.handles.ident=GLOBAL
11 --FILE--
12 <?php
13 echo "-TEST\n";
14
15 echo "No free handles!\n";
16 foreach (http_persistent_handles_count() as $provider => $idents) {
17 foreach ((array)$idents as $ident => $counts) {
18 if (!empty($counts["free"])) {
19 printf("%s, %s, %s\n", $provider, $ident, $counts["free"]);
20 }
21 }
22 }
23
24 http_get("http://www.google.com/", null, $info[]);
25
26 echo "One free request handle within GLOBAL: ";
27 var_dump(http_persistent_handles_count()->http_request["GLOBAL"]["free"]);
28
29 echo "Reusing request handle: ";
30 http_get("http://www.google.com/", null, $info[]);
31 var_dump($info[0]["pretransfer_time"] > 10 * $info[1]["pretransfer_time"], $info[0]["pretransfer_time"], $info[1]["pretransfer_time"]);
32
33 echo "Handles' been cleaned up:\n";
34 http_persistent_handles_clean();
35 print_r(http_persistent_handles_count());
36
37 echo "Done\n";
38 ?>
39 --EXPECTF--
40 %sTEST
41 No free handles!
42 One free request handle within GLOBAL: int(1)
43 Reusing request handle: bool(true)
44 float(%f)
45 float(%f)
46 Handles' been cleaned up:
47 stdClass Object
48 (
49 [http_request] => Array
50 (
51 [GLOBAL] => Array
52 (
53 [used] => 0
54 [free] => 0
55 )
56
57 )
58
59 [http_request_datashare] => Array
60 (
61 [GLOBAL] => Array
62 (
63 [used] => 0
64 [free] => 0
65 )
66
67 )
68
69 [http_request_datashare_lock] => Array
70 (
71 [GLOBAL] => Array
72 (
73 [used] => 0
74 [free] => 0
75 )
76
77 )
78
79 [http_request_pool] => Array
80 (
81 [GLOBAL] => Array
82 (
83 [used] => 0
84 [free] => 0
85 )
86
87 )
88
89 )
90 Done