reduce count of online tests
[m6w6/ext-http] / tests / proxy001.phpt
1 --TEST--
2 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 "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" => 3,
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 unset($r, $client);
34 });
35
36 ?>
37 ===DONE===
38 --EXPECTF--
39 Test
40 Server on port %d
41 CONNECT www.example.com:80 HTTP/1.1
42 Host: www.example.com:80
43 User-Agent: PECL_HTTP/%s PHP/%s libcurl/%s
44 Proxy-Connection: Keep-Alive
45 Hello: there!
46 Content-Length: 0
47 ===DONE===