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