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 a04fc86

Browse filesBrowse files
rickyestargos
authored andcommitted
http2: optimize the altsvc Max bytes limit, define and use constants
PR-URL: #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>
1 parent 64740d4 commit a04fc86
Copy full SHA for a04fc86

File tree

Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-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
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ function debugSessionObj(session, message, ...args) {
162162
const kMaxFrameSize = (2 ** 24) - 1;
163163
const kMaxInt = (2 ** 32) - 1;
164164
const kMaxStreams = (2 ** 31) - 1;
165+
const kMaxALTSVC = (2 ** 14) - 2;
165166

166167
// eslint-disable-next-line no-control-regex
167168
const kQuotedString = /^[\x09\x20-\x5b\x5d-\x7e\x80-\xff]*$/;
@@ -1498,7 +1499,7 @@ class ServerHttp2Session extends Http2Session {
14981499
throw new ERR_INVALID_CHAR('alt');
14991500

15001501
// Max length permitted for ALTSVC
1501-
if ((alt.length + (origin !== undefined ? origin.length : 0)) > 16382)
1502+
if ((alt.length + (origin !== undefined ? origin.length : 0)) > kMaxALTSVC)
15021503
throw new ERR_HTTP2_ALTSVC_LENGTH();
15031504

15041505
this[kHandle].altsvc(stream, origin || '', alt);
@@ -1530,7 +1531,7 @@ class ServerHttp2Session extends Http2Session {
15301531
len += origin.length;
15311532
}
15321533

1533-
if (len > 16382)
1534+
if (len > kMaxALTSVC)
15341535
throw new ERR_HTTP2_ORIGIN_LENGTH();
15351536

15361537
this[kHandle].origin(arr, count);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.