deno
bdb006fd - fix(ext/node): close accepted connections that sent no request on server.close()

Commit
56 days ago
fix(ext/node): close accepted connections that sent no request on server.close() A connection that was accepted but never sent a request was not treated as idle, so server.close() left it open and its callback never ran. The socket has no _httpMessageDetached, which is what closeIdleConnections used as its idle test, so it fell through. Track whether a request has actually begun on the wire, separately from the connections-list entry pushed at accept time for headersTimeout, and treat a connection with no request in progress as idle. Node cannot reach this state: close() stops accepting, so such a connection is still in the accept queue and gets reset. Deno accepts eagerly, so the connection is already tracked and pins the server open. This follows the behavior Node documents, and makes Node's own regression test for it pass - test-http-server-close-idle-connections-pre-request.js, enabled here. Closes #36513
Author
Parents
Loading