Version
v20.5.1
Platform
Darwin Kernel Version 22.6.0
Subsystem
http
What steps will reproduce the bug?
#38262
#38262 (comment)
This often stops after the first iteration:
let http = require("http");
let server = http.createServer(async function(req, res)
{
try
{
let len = 0;
for await (let chunk of req)
{
len += chunk.length;
if(len > 2) throw "payload too large";
}
res.end("ok");
}
catch(err)
{
console.log("server log:", err);
res.end(err);
}
});
(async function()
{
await new Promise(resolve => server.listen(8888, resolve));
let agent = new http.Agent({ keepAlive: true });
let data = Buffer.alloc(1000000);
for(let i = 0; ; i++)
{
console.log(i);
let req = http.request({ port: 8888, method: "post", agent }).end(data);
let res = await new Promise((resolve, reject) => req.on("response", resolve).on("error", reject));
let str = "";
for await (let chunk of res) str += chunk;
console.log(str);
}
}());
How often does it reproduce? Is there a required condition?
Often.
What is the expected behavior? Why is that the expected behavior?
It should continue.
What do you see instead?
0
server log: payload too large
payload too large
1
^C
Version
v20.5.1
Platform
Darwin Kernel Version 22.6.0
Subsystem
http
What steps will reproduce the bug?
#38262
#38262 (comment)
This often stops after the first iteration:
How often does it reproduce? Is there a required condition?
Often.
What is the expected behavior? Why is that the expected behavior?
It should continue.
What do you see instead?