Skip to content

Commit

Permalink
Merge pull request #153 from gailingmic/master
Browse files Browse the repository at this point in the history
Fix Socket closing to early when the buffer has not flushed yet.
  • Loading branch information
apocas authored Oct 10, 2023
2 parents e575864 + 30aee7b commit 077e545
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 077e545

Please sign in to comment.