X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=tests%2Fhelper%2Fpipeline.inc;fp=tests%2Fhelper%2Fpipeline.inc;h=b7175c109fac1b24d4f4a31e000e08cda288ae4d;hp=0000000000000000000000000000000000000000;hb=e867316f1364f589eec67cc684703c874984430b;hpb=baff99d75b56868714f7f2ed1972b3baceb72014 diff --git a/tests/helper/pipeline.inc b/tests/helper/pipeline.inc new file mode 100644 index 0000000..b7175c1 --- /dev/null +++ b/tests/helper/pipeline.inc @@ -0,0 +1,26 @@ +setEnvRequest($msg) + ->setHeader("X-Req", $msg->getRequestUrl()) + ->send($client); +} + +serve(function($client) { + $count = trim(fgets(STDIN)); + + /* the peek message */ + respond($client, new http\Message($client, false)); + + /* pipelined messages */ + $req = array(); + for ($i=0; $i < $count; ++ $i) { + $req[] = new http\Message($client, false); + } + foreach ($req as $msg) { + respond($client, $msg); + } +});