mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
test: keep response open in http2 response limits test
The server ended the response before the request body arrived, so it also sent RST_STREAM(NO_ERROR). When that frame reaches the client in the same read as the rejected headers, the stream is closed by the peer reset before the client's own reset is sent. On v26.x the request then closes without an 'error' event and the test times out. Leave the response open so that only the client resets the stream. Refs: https://github.com/nodejs/node/pull/67114 Signed-off-by: inoway46 <inoueyuya416@gmail.com> Assisted-by: Claude Code PR-URL: https://github.com/nodejs/node/pull/67656 Refs: https://github.com/nodejs/node/actions/runs/44631511460 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
This commit is contained in:
1 parent
10394eea40
commit
c8f38fac87
1 file changed
+4
-3
@@ -16,6 +16,10 @@ async function test(kind, bodySize = 4 * 1024 * 1024) {
|
||||
server.on('session', (session) => sessions.add(session));
|
||||
server.on('stream', (stream) => {
|
||||
stream.on('error', () => {});
|
||||
// Leave the response open. Ending it before the request body arrives
|
||||
// makes the server send RST_STREAM(NO_ERROR), which can reach the client
|
||||
// together with the rejected headers and close the stream before the
|
||||
// client's own reset does.
|
||||
switch (kind) {
|
||||
case 'repeated-informational':
|
||||
for (let i = 0; i < 80; i++) {
|
||||
@@ -25,15 +29,12 @@ async function test(kind, bodySize = 4 * 1024 * 1024) {
|
||||
break;
|
||||
case 'pairs':
|
||||
stream.respond({ ':status': 413, 'a': '1', 'b': '2', 'c': '3', 'd': '4' });
|
||||
stream.end();
|
||||
return;
|
||||
case 'size':
|
||||
stream.respond({ ':status': 413, 'x-large': 'x'.repeat(2048) });
|
||||
stream.end();
|
||||
return;
|
||||
}
|
||||
stream.respond({ ':status': 413 });
|
||||
stream.end();
|
||||
});
|
||||
server.listen(0);
|
||||
await once(server, 'listening');
|
||||
|
||||
Reference in new issue
Block a user