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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Anto Aravinth <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Minwoo Jung <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
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

+1-4
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)