- more fixes for empty message info
[m6w6/ext-http] / tests / HttpRequestPool_002.phpt
1 --TEST--
2 extending HttpRequestPool
3 --SKIPIF--
4 <?php
5 include 'skip.inc';
6 checkcls('HttpRequestPool');
7 checkurl('at.php.net');
8 checkurl('de.php.net');
9 checkurl('www.php.net');
10 ?>
11 --FILE--
12 <?php
13 echo "-TEST\n";
14
15 class MyPool extends HttpRequestPool
16 {
17 public function send()
18 {
19 while ($this->socketPerform()) {
20 if (!$this->socketSelect()) {
21 throw new HttpSocketException;
22 }
23 }
24 }
25
26 protected final function socketPerform()
27 {
28 $result = parent::socketPerform();
29
30 echo ".";
31 foreach ($this->getFinishedRequests() as $r) {
32 echo "=", $r->getResponseCode(), "=";
33 $this->detach($r);
34 }
35
36 return $result;
37 }
38 }
39
40 $pool = new MyPool(
41 new HttpRequest('http://www.php.net/', HTTP_METH_HEAD),
42 new HttpRequest('http://at.php.net/', HTTP_METH_HEAD),
43 new HttpRequest('http://de.php.net/', HTTP_METH_HEAD)
44 );
45
46 $pool->send();
47
48 echo "\nDone\n";
49 ?>
50 --EXPECTREGEX--
51 .+TEST
52 \.*=200=\.*=200=\.*=200=
53 Done