2 client proxy - send proxy headers for a proxy request
8 $client = new http\Client("curl");
9 array_key_exists("proxyheader", $client->getAvailableOptions())
10 or die("skip need libcurl with CURLOPT_PROXYHEADER support\n");
15 include "helper/server.inc";
19 server("proxy.inc", function($port, $stdin, $stdout, $stderr) {
20 echo "Server on port $port\n";
23 $r = new http\Client\Request("GET", "http://www.example.com/");
26 "proxytunnel" => true,
27 "proxyheader" => array("Hello" => "there!"),
28 "proxyhost" => "localhost",
32 $c->enqueue($r)->send();
33 } catch (Exception $e) {
36 echo $c->getResponse()->getBody();
44 CONNECT www.example.com:80 HTTP/1.1
46 Host: www.example.com:80
47 %r(Proxy-Connection: Keep-Alive
48 )?%rUser-Agent: PECL_HTTP/%s PHP/%s libcurl/%s