Merge branch 'v2.6.x'
[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 server("pipeline.inc", function($port, $stdin, $stdout, $stderr) {
16 /* tell the server we're about to send 3 pipelined messages */
17 fputs($stdin, "3\n");
18
19 $client = new http\Client(null);
20 $client->configure(array("pipelining" => true, "max_host_connections" => 0));
21
22 /* this is just to let curl know the server may be capable of pipelining */
23 $client->enqueue(new http\Client\Request("GET", "http://localhost:$port"));
24 $client->send();
25
26 $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/1"));
27 $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/2"));
28 $client->enqueue(new http\Client\Request("GET", "http://localhost:$port/3"));
29 $client->send();
30
31 while (($response = $client->getResponse())) {
32 echo $response;
33 }
34 });
35
36 ?>
37 ===DONE===
38 --EXPECT--
39 Test
40 HTTP/1.1 200 OK
41 X-Req: /3
42 Etag: ""
43 X-Original-Transfer-Encoding: chunked
44 HTTP/1.1 200 OK
45 X-Req: /2
46 Etag: ""
47 X-Original-Transfer-Encoding: chunked
48 HTTP/1.1 200 OK
49 X-Req: /1
50 Etag: ""
51 X-Original-Transfer-Encoding: chunked
52 HTTP/1.1 200 OK
53 X-Req: /
54 Etag: ""
55 X-Original-Transfer-Encoding: chunked
56 ===DONE===