diff --git a/lib/internal/quic/core.js b/lib/internal/quic/core.js index 0730303a134bc2..d311852d950410 100644 --- a/lib/internal/quic/core.js +++ b/lib/internal/quic/core.js @@ -2942,14 +2942,14 @@ class QuicStream extends Duplex { validateObject(headers, 'headers'); - // Push streams are only supported on QUIC servers, and - // only if the original stream is bidirectional. - // TODO(@jasnell): This is really an http/3 specific - // requirement so if we end up later with another - // QUIC application protocol that has a similar - // notion of push streams without this restriction, - // then we'll need to check alpn value here also. - if (!this.clientInitiated && !this.bidirectional) { + // This is a small performance optimization for http/3, + // where push streams are only supported for client + // initiated, bidirectional streams. For any other alpn, + // we'll make the attempt to push and handle the failure + // after. + if (!this.clientInitiated && + !this.bidirectional && + this.session.alpnProtocol === 'h3-29') { throw new ERR_INVALID_STATE( 'Push streams are only supported on client-initiated, ' + 'bidirectional streams');