From 9c70bf356be1a66d0abf70662f2894a97f7ad148 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 18 May 2009 14:02:50 +0200 Subject: [PATCH] HTTP Server: check the ready state of the connection before each send. --- src/http.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/http.js b/src/http.js index b70b20aaa6..ac2de941ff 100644 --- a/src/http.js +++ b/src/http.js @@ -72,6 +72,12 @@ node.http.Server = function (RequestHandler, options) { // is wasteful. *I think* its rather faster to concat inside of JS // Thus I attempt to concat as much as possible. function send (data) { + if (connection.readyState === "closed" || connection.readyState === "readOnly") + { + responses = []; + return; + } + if (output.length == 0) { output.push(data); return; @@ -267,7 +273,8 @@ node.http.Server = function (RequestHandler, options) { }; } - this.__proto__.__proto__ = new node.http.LowLevelServer(ConnectionHandler, options); + this.__proto__.__proto__ = + new node.http.LowLevelServer(ConnectionHandler, options); }; node.http.Client = function (port, host) {