From 9b1341cdc88d7359481c87f25e495b0a9909ebb7 Mon Sep 17 00:00:00 2001 From: Fedor Indutny Date: Mon, 13 Apr 2015 16:31:57 +0200 Subject: [PATCH] http_server: `prefinish` vs `finish` Do not detach the socket from the response until all data is actually sent to the other side. See: https://github.com/iojs/io.js/pull/1373 PR-URL: https://github.com/nodejs/io.js/pull/1411 Reviewed-By: Chris Dickinson Reviewed-By: Jeremiah Senkpiel --- lib/_http_server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_http_server.js b/lib/_http_server.js index b696b9bc0cac6c..59ea2bdda4d2e1 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -431,7 +431,7 @@ function connectionListener(socket) { // When we're finished writing the response, check if this is the last // respose, if so destroy the socket. - res.on('prefinish', resOnFinish); + res.on('finish', resOnFinish); function resOnFinish() { // Usually the first incoming element should be our request. it may // be that in the case abortIncoming() was called that the incoming