X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fhelper%2Fpipeline.inc;h=942d254ea8b316b0eb188bfba00a3f3f1e0c9727;hb=a4df85a0ee26bd18d7f7780c19829e3902b11426;hp=815b46339b672574284138ec976cf8da0b472827;hpb=aba1f7d332d866ca1f0397d46751864e430985f3;p=m6w6%2Fext-http diff --git a/tests/helper/pipeline.inc b/tests/helper/pipeline.inc index 815b463..942d254 100644 --- a/tests/helper/pipeline.inc +++ b/tests/helper/pipeline.inc @@ -3,23 +3,26 @@ include "server.inc"; function respond($client, $msg) { - (new http\Env\Response)->setEnvRequest($msg) + $r = new http\Env\Response; + $r->setEnvRequest($msg) ->setHeader("X-Req", $msg->getRequestUrl()) ->send($client); } serve(function($client) { $count = trim(fgets(STDIN)); - + logger("Expecting %d messages", $count); /* the peek message */ respond($client, new http\Message($client, false)); - + logger("Handled the peek request"); /* pipelined messages */ $req = array(); for ($i=0; $i < $count; ++ $i) { $req[] = new http\Message($client, false); + logger("Read request no. %d", $i+1); } - foreach ($req as $msg) { + foreach ($req as $i => $msg) { respond($client, $msg); + logger("Sent response no. %d", $i+1); } });