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 <christopher.s.dickinson@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
Fedor Indutny 2015-04-13 16:31:57 +02:00 committed by Rod Vagg
parent ef2c8cd4ec
commit 11e4249227

View File

@ -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