Skip to content

Commit 5959023

Browse files
addaleaxtargos
authored andcommitted
http2: fix file close error condition at respondWithFd
Closing a FileHandle almost never fails, so it was hard to notice before that `stream.emit(err)` would not emit an error event due to the missing event name. Destroying the stream with the error seems like the right thing to do in that scenario. PR-URL: #29884 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
1 parent dcdb96c commit 5959023

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/internal/http2/core.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2174,14 +2174,11 @@ function processHeaders(oldHeaders) {
21742174
return headers;
21752175
}
21762176

2177-
function onFileCloseError(stream, err) {
2178-
stream.emit(err);
2179-
}
21802177

21812178
function onFileUnpipe() {
21822179
const stream = this.sink[kOwner];
21832180
if (stream.ownsFd)
2184-
this.source.close().catch(onFileCloseError.bind(stream));
2181+
this.source.close().catch(stream.destroy.bind(stream));
21852182
else
21862183
this.source.releaseFD();
21872184
}

0 commit comments

Comments
 (0)