Skip to content

Commit

Permalink
Add destroy methods to HTTP messages
Browse files Browse the repository at this point in the history
needs tests (particularly for pipeline situations)
  • Loading branch information
ry committed Oct 11, 2010
1 parent 372a7c9 commit 8139bb2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ function IncomingMessage (socket) {
util.inherits(IncomingMessage, stream.Stream);
exports.IncomingMessage = IncomingMessage;


IncomingMessage.prototype.destroy = function (error) {
this.socket.destroy(error);
};


IncomingMessage.prototype.setEncoding = function (encoding) {
var StringDecoder = require("string_decoder").StringDecoder; // lazy load
this._decoder = new StringDecoder(encoding);
Expand Down Expand Up @@ -303,6 +309,12 @@ function OutgoingMessage (socket) {
util.inherits(OutgoingMessage, stream.Stream);
exports.OutgoingMessage = OutgoingMessage;


OutgoingMessage.prototype.destroy = function (error) {
this.socket.destroy(error);
};


// This abstract either writing directly to the socket or buffering it.
OutgoingMessage.prototype._send = function (data, encoding) {
// This is a shameful hack to get the headers and first body chunk onto
Expand Down

0 comments on commit 8139bb2

Please # to comment.