From df23ce138fbe4584a72d24e1f3e6858cf518f302 Mon Sep 17 00:00:00 2001 From: isaacs Date: Thu, 15 Aug 2013 11:15:10 -0700 Subject: [PATCH] http: Simplify IncomingMessage._dump method --- lib/_http_incoming.js | 13 +++++-------- test/simple/test-http-byteswritten.js | 5 +---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js index 8949d4571ae..cc93bfc9f15 100644 --- a/lib/_http_incoming.js +++ b/lib/_http_incoming.js @@ -23,14 +23,14 @@ var util = require('util'); var Stream = require('stream'); function readStart(socket) { - if (!socket || !socket._handle || !socket._handle.readStart) return; - socket._handle.readStart(); + if (socket) + socket.resume(); } exports.readStart = readStart; function readStop(socket) { - if (!socket || !socket._handle || !socket._handle.readStop) return; - socket._handle.readStop(); + if (socket) + socket.pause(); } exports.readStop = readStop; @@ -196,9 +196,6 @@ IncomingMessage.prototype._addHeaderLine = function(field, value, dest) { IncomingMessage.prototype._dump = function() { if (!this._dumped) { this._dumped = true; - if (this.socket.parser) this.socket.parser.incoming = null; - this.push(null); - readStart(this.socket); - this.read(); + this.resume(); } }; diff --git a/test/simple/test-http-byteswritten.js b/test/simple/test-http-byteswritten.js index 92bb2729c57..dedc2399c22 100644 --- a/test/simple/test-http-byteswritten.js +++ b/test/simple/test-http-byteswritten.js @@ -58,9 +58,6 @@ var httpServer = http.createServer(function(req, res) { }); httpServer.listen(common.PORT, function() { - // XXX(isaacs): This should not be necessary. - http.get({ port: common.PORT }, function(res) { - res.resume(); - }); + http.get({ port: common.PORT }); });