Skip to content

Commit e573c39

Browse files
ronagTrott
authored andcommitted
http: don't emit 'data' after 'error'
PR-URL: #28711 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 1665a93 commit e573c39

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

lib/_http_client.js

-3
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,6 @@ function socketErrorListener(err) {
406406
req.emit('error', err);
407407
}
408408

409-
// Handle any pending data
410-
socket.read();
411-
412409
const parser = socket.parser;
413410
if (parser) {
414411
parser.finish();

test/parallel/test-http-client-read-in-error.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const net = require('net');
44
const http = require('http');
55

@@ -37,4 +37,5 @@ http.request({
3737
agent
3838
}).once('error', function() {
3939
console.log('ignore');
40+
this.on('data', common.mustNotCall());
4041
});

0 commit comments

Comments
 (0)