5 function respond($client, $msg) {
6 $r = new http\Env\Response;
7 $r->setEnvRequest($msg)
8 ->setHeader("X-Req", $msg->getRequestUrl())
12 serve(function($client) {
13 $count = trim(fgets(STDIN));
15 /* the peek message */
16 respond($client, new http\Message($client, false));
18 /* pipelined messages */
20 for ($i=0; $i < $count; ++ $i) {
21 $req[] = new http\Message($client, false);
23 foreach ($req as $msg) {
24 respond($client, $msg);