Skip to content

Commit

Permalink
http: don't emit 'data' after 'error'
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Aug 18, 2019
1 parent 5dee17b commit be5940b
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
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,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
Original file line number Diff line number Diff line change
@@ -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 be5940b

Please sign in to comment.