884a3c60f23dac9063926e8f9add496e34b7325c
[m6w6/ext-http] / tests / client018.phpt
1 --TEST--
2 client pipelining
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 skip_client_test();
7 ?>
8 --FILE--
9 <?php
10
11 include "helper/server.inc";
12
13 echo "Test\n";
14
15 function dump($response) {
16 echo $response->getHeader("X-Req"),"\n";
17 }
18
19 server("pipeline.inc", function($port, $stdin, $stdout, $stderr) {
20 /* tell the server we're about to send 3 pipelined messages */
21 fputs($stdin, "3\n");
22
23 $client = new http\Client(null);
24 $client->configure(array("pipelining" => true, "max_host_connections" => 0));
25
26 /* this is just to let curl know the server may be capable of pipelining */
27 $client->enqueue(new http\Client\Request("GET", "http://localhost:$port"), "dump");
28 $client->send();
29
30 $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/1"), "dump");
31 $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/2"), "dump");
32 $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/3"), "dump");
33 $client->send();
34 });
35
36 ?>
37 ===DONE===
38 --EXPECT--
39 Test
40 /
41 /1
42 /2
43 /3
44 ===DONE===