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 2a9912c

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

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
@@ -1906,7 +1906,10 @@ class Http2Stream extends Duplex {
19061906
!(state.flags & STREAM_FLAGS_HAS_TRAILERS) &&
19071907
!state.didRead &&
19081908
this.readableFlowing === null) {
1909-
this.close();
1909+
// By using setImmediate we allow pushStreams to make it through
1910+
// before the stream is officially closed. This prevents a bug
1911+
// in most browsers where those pushStreams would be rejected.
1912+
setImmediate(this.close.bind(this));
19101913
}
19111914
}
19121915
}
@@ -2178,7 +2181,7 @@ class ServerHttp2Stream extends Http2Stream {
21782181
let headRequest = false;
21792182
if (headers[HTTP2_HEADER_METHOD] === HTTP2_METHOD_HEAD)
21802183
headRequest = options.endStream = true;
2181-
options.readable = !options.endStream;
2184+
options.readable = false;
21822185

21832186
const headersList = mapToHeaders(headers);
21842187
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.