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 91be1dc

Browse filesBrowse files
apapirovskiBethGriggs
authored andcommitted
http2: delay closing stream
Delay automatically closing the stream with setImmediate in order to allow any pushStreams to be sent first. Backport-PR-URL: #22850 PR-URL: #20997 Fixes: #20992 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 5d29e2c commit 91be1dc
Copy full SHA for 91be1dc

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎lib/internal/http2/core.js‎

Copy file name to clipboardExpand all lines: lib/internal/http2/core.js
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,7 +1902,10 @@ class Http2Stream extends Duplex {
19021902
!(state.flags & STREAM_FLAGS_HAS_TRAILERS) &&
19031903
!state.didRead &&
19041904
this._readableState.flowing === null) {
1905-
this.close();
1905+
// By using setImmediate we allow pushStreams to make it through
1906+
// before the stream is officially closed. This prevents a bug
1907+
// in most browsers where those pushStreams would be rejected.
1908+
setImmediate(this.close.bind(this));
19061909
}
19071910
}
19081911
}
@@ -2137,7 +2140,7 @@ class ServerHttp2Stream extends Http2Stream {
21372140
let headRequest = false;
21382141
if (headers[HTTP2_HEADER_METHOD] === HTTP2_METHOD_HEAD)
21392142
headRequest = options.endStream = true;
2140-
options.readable = !options.endStream;
2143+
options.readable = false;
21412144

21422145
const headersList = mapToHeaders(headers);
21432146
if (!Array.isArray(headersList))

0 commit comments

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