CURLOPT_PROXYHEADER support; default chunked encoding for stream
[m6w6/ext-http] / tests / proxy002.phpt
1 --TEST--
2 proxy - don't send proxy headers for a standard request
3 --SKIPIF--
4 <?php
5 include "skipif.inc";
6 skip_client_test();
7 ?>
8 --FILE--
9 <?php
10
11 echo "Test\n";
12
13 $spec = array(array("pipe","r"), array("pipe","w"), array("pipe","w"));
14 if (($proc = proc_open(PHP_BINARY . " proxy.inc", $spec, $pipes, __DIR__))) {
15 $port = trim(fgets($pipes[2]));
16 echo "Server on port $port\n";
17 $c = new http\Client;
18 $r = new http\Client\Request("GET", "http://localhost:$port/");
19 $r->setOptions(array(
20 "timeout" => 3,
21 "proxyheader" => array("Hello" => "there!"),
22 ));
23 try {
24 $c->enqueue($r)->send();
25 } catch (Exception $e) {
26 echo $e;
27 }
28 echo $c->getResponse()->getBody();
29 while (!feof($pipes[1])) {
30 echo fgets($pipes[1]);
31 }
32 unset($r, $client);
33 }
34 ?>
35 ===DONE===
36 --EXPECTF--
37 Test
38 Server on port %d
39 GET / HTTP/1.1
40 User-Agent: PECL_HTTP/%s PHP/%s libcurl/%s
41 Host: localhost:%d
42 Accept: */*
43 Content-Length: 0
44 ===DONE===