projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
gh-actions: ci: fix script location
[m6w6/ext-http]
/
tests
/
helper
/
pipeline.inc
diff --git
a/tests/helper/pipeline.inc
b/tests/helper/pipeline.inc
index 815b46339b672574284138ec976cf8da0b472827..6f3674ce9c1c764db8e81740a16a46e3153a8040 100644
(file)
--- a/
tests/helper/pipeline.inc
+++ b/
tests/helper/pipeline.inc
@@
-3,23
+3,31
@@
include "server.inc";
function respond($client, $msg) {
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) {
->setHeader("X-Req", $msg->getRequestUrl())
->send($client);
}
serve(function($client) {
+ $R = array(STDIN); $W = $E = array();
+ if (!stream_select($R, $W, $E, 10, 0)) {
+ logger("Client %d timed out", (int) $client);
+ return;
+ }
$count = trim(fgets(STDIN));
$count = trim(fgets(STDIN));
-
+ logger("Expecting %d messages from client %d", $count, (int) $client);
/* the peek message */
respond($client, new http\Message($client, false));
/* the peek message */
respond($client, new http\Message($client, false));
-
+ logger("Handled the peek request of client %d", (int) $client);
/* pipelined messages */
$req = array();
for ($i=0; $i < $count; ++ $i) {
/* pipelined messages */
$req = array();
for ($i=0; $i < $count; ++ $i) {
- $req[] = new http\Message($client, false);
+ $req[] = $m = new http\Message($client, false);
+ logger("Read request no. %d from client %d (%s)", $i+1, (int) $client, $m->getRequestUrl());
}
}
- foreach ($req as $msg) {
+ foreach ($req as $
i => $
msg) {
respond($client, $msg);
respond($client, $msg);
+ logger("Sent response no. %d to client %d", $i+1, (int) $client);
}
});
}
});