--FILE--
<?php
+include "server.inc";
+
echo "Test\n";
-$spec = array(array("pipe","r"), array("pipe","w"), array("pipe","w"));
-if (($proc = proc_open(PHP_BINARY . " proxy.inc", $spec, $pipes, __DIR__))) {
- $port = trim(fgets($pipes[2]));
+server("proxy.inc", function($port, $stdin, $stdout, $stderr) {
echo "Server on port $port\n";
+
$c = new http\Client;
$r = new http\Client\Request("GET", "http://www.example.com/");
$r->setOptions(array(
- "timeout" => 3,
- "proxytunnel" => true,
- "proxyheader" => array("Hello" => "there!"),
- "proxyhost" => "localhost",
- "proxyport" => $port,
+ "timeout" => 3,
+ "proxytunnel" => true,
+ "proxyheader" => array("Hello" => "there!"),
+ "proxyhost" => "localhost",
+ "proxyport" => $port,
));
try {
$c->enqueue($r)->send();
echo $e;
}
echo $c->getResponse()->getBody();
- while (!feof($pipes[1])) {
- echo fgets($pipes[1]);
- }
unset($r, $client);
-}
+});
+
?>
===DONE===
--EXPECTF--