Skip to content

Commit

Permalink
fix Socket closing to early when the buffer hasnt flushed yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
gailingmic authored May 3, 2023
1 parent e55461b commit 30aee7b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/http_duplex.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ HttpDuplex.prototype._write = function(chunk, encoding, cb) {
};

HttpDuplex.prototype.end = function(chunk, encoding, cb) {
this._output.socket.destroy();
this._output.socket.destroySoon();
return this.req.end(chunk, encoding, cb);
};

HttpDuplex.prototype.destroy = function() {
this.req.destroy();
this._output.socket.destroy();
};

HttpDuplex.prototype.destroySoon = function() {
this.req.destroy();
this._output.socket.destroy();
};

0 comments on commit 30aee7b

Please sign in to comment.