(gcov) tests fixup
[m6w6/ext-http] / tests / client019.phpt
1 --TEST--
2 client proxy - send proxy headers for a proxy request
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("proxy.inc", function($port, $stdin, $stdout, $stderr) {
16 echo "Server on port $port\n";
17
18 $c = new http\Client;
19 $r = new http\Client\Request("GET", "http://www.example.com/");
20 $r->setOptions(array(
21 "timeout" => 10,
22 "proxytunnel" => true,
23 "proxyheader" => array("Hello" => "there!"),
24 "proxyhost" => "localhost",
25 "proxyport" => $port,
26 ));
27 try {
28 $c->enqueue($r)->send();
29 } catch (Exception $e) {
30 echo $e;
31 }
32 echo $c->getResponse()->getBody();
33 });
34
35 ?>
36 ===DONE===
37 --EXPECTF--
38 Test
39 Server on port %d
40 CONNECT www.example.com:80 HTTP/1.1
41 Host: www.example.com:80
42 User-Agent: PECL_HTTP/%s PHP/%s libcurl/%s
43 Proxy-Connection: Keep-Alive
44 Hello: there!
45 ===DONE===