mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-27 06:43:19 +08:00
request.end(body) on a request whose head was not sent yet wrote the head and then the body. On a socket that was already connected (a reused keep-alive connection), each write is sent at once, so the two went out as separate segments, and the server could handle the head and answer before the body arrived. Node sends the head together with the body. When the client and the server run in one program, the server's 'end' and 'close' for the request and the client's reading of the response then depended on which socket the poller reported first: corpus 5409-http-held-request-body printed the client's line before the request's 'end' and 'close' in a macOS dev build. The head and a body known at end() now go out as one write, as Node sends them (the server's response already did).