Skip to content

Commit

Permalink
fixup: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Apr 15, 2018
1 parent 753ca2b commit 8ffc3c7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,16 @@ function socketCloseListener() {

// NOTE: It's important to get parser here, because it could be freed by
// the `socketOnData`.
var parser = socket.parser;
var res = req.res;
const parser = socket.parser;
const res = req.res;
if (res) {
if (res.readable) {
// Socket closed before we emitted 'end' below.
res.emit('aborted');
if (!res.complete) {
res.emit('aborted');
}
res.on('end', function() {
this.emit('close');
res.emit('close');
});
res.push(null);
} else {
Expand Down

0 comments on commit 8ffc3c7

Please sign in to comment.