Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/http.js')
-rw-r--r--lib/http.js13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/http.js b/lib/http.js
index 0b4a0e2212f..960d28aaa36 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() { };
@@ -734,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();
};
}
@@ -834,12 +831,7 @@ 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();
- } else {
- socket.destroy();
- }
+ socket.destroySoon();
} else if (socket._outgoing.length) {
// Push out the next message.
@@ -872,6 +864,7 @@ function connectionListener(socket) {
return false; // Not a HEAD response. (Not even a response!)
};
}
+exports._connectionListener = connectionListener;
function Client() {