Skip to content

Commit 344c5e4

Browse files
committed
quic: limit push check to http/3
PR-URL: #34655 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 34165f0 commit 344c5e4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/internal/quic/core.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -2942,14 +2942,14 @@ class QuicStream extends Duplex {
29422942

29432943
validateObject(headers, 'headers');
29442944

2945-
// Push streams are only supported on QUIC servers, and
2946-
// only if the original stream is bidirectional.
2947-
// TODO(@jasnell): This is really an http/3 specific
2948-
// requirement so if we end up later with another
2949-
// QUIC application protocol that has a similar
2950-
// notion of push streams without this restriction,
2951-
// then we'll need to check alpn value here also.
2952-
if (!this.clientInitiated && !this.bidirectional) {
2945+
// This is a small performance optimization for http/3,
2946+
// where push streams are only supported for client
2947+
// initiated, bidirectional streams. For any other alpn,
2948+
// we'll make the attempt to push and handle the failure
2949+
// after.
2950+
if (!this.clientInitiated &&
2951+
!this.bidirectional &&
2952+
this.session.alpnProtocol === 'h3-29') {
29532953
throw new ERR_INVALID_STATE(
29542954
'Push streams are only supported on client-initiated, ' +
29552955
'bidirectional streams');

0 commit comments

Comments
 (0)