[Pkg-javascript-commits] [node-stream-http] 63/208: add process.nextTick for 'close'

Bastien Roucariès rouca at moszumanska.debian.org
Sun Aug 13 13:39:29 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-stream-http.

commit 5e81240a05b2f9a96d2359d905bab62772b829d4
Author: John Hiesey <john at hiesey.com>
Date:   Mon Jul 13 18:14:30 2015 -0700

    add process.nextTick for 'close'
---
 lib/response.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/response.js b/lib/response.js
index 96f5bc9..9994d90 100644
--- a/lib/response.js
+++ b/lib/response.js
@@ -23,7 +23,10 @@ var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode) {
 
 	// Fake the 'close' event, but only once 'end' fires
 	self.on('end', function () {
-		self.emit('close')
+		// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
+		process.nextTick(function () {
+			self.emit('close')
+		})
 	})
 
 	if (mode === 'fetch') {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-http.git



More information about the Pkg-javascript-commits mailing list