aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorrickyes <mail@zhoumq.cn>2019-09-24 00:28:40 +0800
committerRich Trott <rtrott@gmail.com>2019-09-25 22:31:37 -0700
commit322e1e15d5b878f426c4def907a4941968b22912 (patch)
tree6aadc01fecc347c224da0b06d81995b038d5f3f5 /lib
parent899dd15f8f86c1c7b0b64c0d11545269737a69d0 (diff)
downloadandroid-node-v8-322e1e15d5b878f426c4def907a4941968b22912.tar.gz
android-node-v8-322e1e15d5b878f426c4def907a4941968b22912.tar.bz2
android-node-v8-322e1e15d5b878f426c4def907a4941968b22912.zip
http2: optimize the altsvc Max bytes limit, define and use constants
PR-URL: https://github.com/nodejs/node/pull/29673 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/internal/http2/core.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js
index 7a1847f770..4ec3608d49 100644
--- a/lib/internal/http2/core.js
+++ b/lib/internal/http2/core.js
@@ -161,6 +161,7 @@ function debugSessionObj(session, message, ...args) {
const kMaxFrameSize = (2 ** 24) - 1;
const kMaxInt = (2 ** 32) - 1;
const kMaxStreams = (2 ** 31) - 1;
+const kMaxALTSVC = (2 ** 14) - 2;
// eslint-disable-next-line no-control-regex
const kQuotedString = /^[\x09\x20-\x5b\x5d-\x7e\x80-\xff]*$/;
@@ -1476,7 +1477,7 @@ class ServerHttp2Session extends Http2Session {
throw new ERR_INVALID_CHAR('alt');
// Max length permitted for ALTSVC
- if ((alt.length + (origin !== undefined ? origin.length : 0)) > 16382)
+ if ((alt.length + (origin !== undefined ? origin.length : 0)) > kMaxALTSVC)
throw new ERR_HTTP2_ALTSVC_LENGTH();
this[kHandle].altsvc(stream, origin || '', alt);
@@ -1508,7 +1509,7 @@ class ServerHttp2Session extends Http2Session {
len += origin.length;
}
- if (len > 16382)
+ if (len > kMaxALTSVC)
throw new ERR_HTTP2_ORIGIN_LENGTH();
this[kHandle].origin(arr, count);