Skip to content

Commit

Permalink
http2: send RST code 8 when abort called
Browse files Browse the repository at this point in the history
  • Loading branch information
devm33 committed Jun 26, 2023
1 parent 32eb492 commit d8bdb21
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -2318,10 +2318,17 @@ class Http2Stream extends Duplex {
// this stream's close and destroy operations.
// Previously, this always overrode a successful close operation code
// NGHTTP2_NO_ERROR (0) with sessionCode because the use of the || operator.
const code = (err != null ?
(sessionCode || NGHTTP2_INTERNAL_ERROR) :
(this.closed ? this.rstCode : sessionCode)
);
let code = this.closed ? this.rstCode : sessionCode;
if (err != null) {
if (sessionCode) {
code = sessionCode;
} else if (err instanceof AbortError) {
// Enables using AbortController to cancel requests with RST code 8.
code = NGHTTP2_CANCEL;
} else {
code = NGHTTP2_INTERNAL_ERROR;
}
}
const hasHandle = handle !== undefined;

if (!this.closed)
Expand Down

0 comments on commit d8bdb21

Please sign in to comment.