From e4dd5cd6fd7b44f4fc21a5cfd39615a7a5833957 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 3 Jan 2011 15:27:57 -0800 Subject: NODE_DEBUG uses strings instead of bitflags --- lib/http.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/http.js') diff --git a/lib/http.js b/lib/http.js index 0b4a0e2212f..5594a8ff1c4 100644 --- a/lib/http.js +++ b/lib/http.js @@ -6,8 +6,7 @@ var HTTPParser = process.binding('http_parser').HTTPParser; var debug; -var debugLevel = parseInt(process.env.NODE_DEBUG, 16); -if (debugLevel & 0x4) { +if (process.env.NODE_DEBUG && /http/.test(process.env.NODE_DEBUG)) { debug = function(x) { console.error('HTTP: %s', x); }; } else { debug = function() { }; -- cgit v1.2.3 From 94f8368cf9e5077050525e32a24188402f077074 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 2 Jan 2011 01:13:56 -0800 Subject: First pass at new https server --- lib/http.js | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/http.js') diff --git a/lib/http.js b/lib/http.js index 5594a8ff1c4..786f373e743 100644 --- a/lib/http.js +++ b/lib/http.js @@ -871,6 +871,7 @@ function connectionListener(socket) { return false; // Not a HEAD response. (Not even a response!) }; } +exports._connectionListener = connectionListener; function Client() { -- cgit v1.2.3 From 73f4ec51fde3bfb3e16d6d706aae42656d083c1a Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 4 Jan 2011 10:36:05 -0800 Subject: hack for ending https connections --- lib/http.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lib/http.js') diff --git a/lib/http.js b/lib/http.js index 786f373e743..f061effe331 100644 --- a/lib/http.js +++ b/lib/http.js @@ -833,11 +833,17 @@ function connectionListener(socket) { if (message._last) { // No more messages to be pushed out. - // HACK: need way to do this with socket interface - if (socket._writeQueue.length) { - socket.__destroyOnDrain = true; //socket.end(); + if (!socket._writeQueue) { + // Putting this here for https. Really need to add below hack to + // both socket and https interfaces. + socket.end(); } else { - socket.destroy(); + // HACK: need way to do this with socket interface + if (socket._writeQueue.length) { + socket.__destroyOnDrain = true; //socket.end(); + } else { + socket.destroy(); + } } } else if (socket._outgoing.length) { -- cgit v1.2.3 From 2957382991c6559fa397d0f9a790ee82f5029b37 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 4 Jan 2011 11:22:17 -0800 Subject: Implement new stream method, destroySoon Still missing on fs.WriteStream --- lib/http.js | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'lib/http.js') diff --git a/lib/http.js b/lib/http.js index f061effe331..960d28aaa36 100644 --- a/lib/http.js +++ b/lib/http.js @@ -733,13 +733,11 @@ function httpSocketSetup(socket) { // An array of outgoing messages for the socket. In pipelined connections // we need to keep track of the order they were sent. socket._outgoing = []; - socket.__destroyOnDrain = false; // NOTE: be sure not to use ondrain elsewhere in this file! socket.ondrain = function() { var message = socket._outgoing[0]; if (message) message.emit('drain'); - if (socket.__destroyOnDrain) socket.destroy(); }; } @@ -833,18 +831,7 @@ function connectionListener(socket) { if (message._last) { // No more messages to be pushed out. - if (!socket._writeQueue) { - // Putting this here for https. Really need to add below hack to - // both socket and https interfaces. - socket.end(); - } else { - // HACK: need way to do this with socket interface - if (socket._writeQueue.length) { - socket.__destroyOnDrain = true; //socket.end(); - } else { - socket.destroy(); - } - } + socket.destroySoon(); } else if (socket._outgoing.length) { // Push out the next message. -- cgit v1.2.3