mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-28 06:53:42 +08:00
Node 24's http.Agent installs a read guard on each socket it puts in freeSockets: bytes that arrive while the socket is idle destroy it, so they are never read as the response to the next request that reuses the socket. scriptc discarded the bytes and kept the socket in the pool, so the next request reused it (reusedSocket true, one connection) where Node dials a new one. The client connection's data hook now destroys the socket when it is in an agent's free list. The socket leaves freeSockets and totalSocketCount, and the next request through the agent opens a new connection, as in Node. Corpus 6200 covers an idle socket that receives a stray response.