From 344c5e4e508ee6c7fad98bb5a34daa98ff43df68 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 6 Aug 2020 17:04:24 -0700 Subject: [PATCH] quic: limit push check to http/3 PR-URL: https://github.com/nodejs/node/pull/34655 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- lib/internal/quic/core.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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');