Browse Source

Add destroy methods to HTTP messages

needs tests (particularly for pipeline situations)
v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
8139bb24c1
  1. 12
      lib/http.js

12
lib/http.js

@ -210,6 +210,12 @@ function IncomingMessage (socket) {
util.inherits(IncomingMessage, stream.Stream); util.inherits(IncomingMessage, stream.Stream);
exports.IncomingMessage = IncomingMessage; exports.IncomingMessage = IncomingMessage;
IncomingMessage.prototype.destroy = function (error) {
this.socket.destroy(error);
};
IncomingMessage.prototype.setEncoding = function (encoding) { IncomingMessage.prototype.setEncoding = function (encoding) {
var StringDecoder = require("string_decoder").StringDecoder; // lazy load var StringDecoder = require("string_decoder").StringDecoder; // lazy load
this._decoder = new StringDecoder(encoding); this._decoder = new StringDecoder(encoding);
@ -303,6 +309,12 @@ function OutgoingMessage (socket) {
util.inherits(OutgoingMessage, stream.Stream); util.inherits(OutgoingMessage, stream.Stream);
exports.OutgoingMessage = OutgoingMessage; exports.OutgoingMessage = OutgoingMessage;
OutgoingMessage.prototype.destroy = function (error) {
this.socket.destroy(error);
};
// This abstract either writing directly to the socket or buffering it. // This abstract either writing directly to the socket or buffering it.
OutgoingMessage.prototype._send = function (data, encoding) { OutgoingMessage.prototype._send = function (data, encoding) {
// This is a shameful hack to get the headers and first body chunk onto // This is a shameful hack to get the headers and first body chunk onto

Loading…
Cancel
Save