Skip to content

Commit

Permalink
http: don't emit 'data' after 'error'
Browse files Browse the repository at this point in the history
PR-URL: #28711
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
ronag authored and Trott committed Sep 23, 2019
1 parent 1665a93 commit e573c39
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 0 additions & 3 deletions lib/_http_client.js
Expand Up @@ -406,9 +406,6 @@ function socketErrorListener(err) {
req.emit('error', err);
}

// Handle any pending data
socket.read();

const parser = socket.parser;
if (parser) {
parser.finish();
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-http-client-read-in-error.js
@@ -1,5 +1,5 @@
'use strict';
require('../common');
const common = require('../common');
const net = require('net');
const http = require('http');

Expand Down Expand Up @@ -37,4 +37,5 @@ http.request({
agent
}).once('error', function() {
console.log('ignore');
this.on('data', common.mustNotCall());
});

0 comments on commit e573c39

Please sign in to comment.