Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ef32069

Browse filesBrowse files
ronagMylesBorins
authored andcommitted
http: don't emit 'finish' after 'error'
PR-URL: #32276 Refs: #28710 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 05fd160 commit ef32069
Copy full SHA for ef32069

File tree

Expand file treeCollapse file tree

2 files changed

+5
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-0
lines changed
Open diff view settings
Collapse file

‎lib/_http_outgoing.js‎

Copy file name to clipboardExpand all lines: lib/_http_outgoing.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ OutgoingMessage.prototype.addTrailers = function addTrailers(headers) {
736736
};
737737

738738
function onFinish(outmsg) {
739+
if (outmsg && outmsg.socket && outmsg.socket._hadError) return;
739740
outmsg.emit('finish');
740741
}
741742

Collapse file

‎test/parallel/test-tls-set-secure-context.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-tls-set-secure-context.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function makeRequest(port, id) {
8282
headers: { id }
8383
};
8484

85+
let errored = false;
8586
https.get(`https://localhost:${port}`, options, (res) => {
8687
let response = '';
8788

@@ -95,7 +96,10 @@ function makeRequest(port, id) {
9596
resolve(response);
9697
}));
9798
}).on('error', (err) => {
99+
errored = true;
98100
reject(err);
101+
}).on('finish', () => {
102+
assert.strictEqual(errored, false);
99103
});
100104
});
101105
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.