-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add 'maxHeaderSize' to 'http2' #33517
Comments
-1 on this, as I said #32388 (comment) |
@himself65 I donβt see any issues with adding an alias for parity between HTTP/1 and HTTP/2. Having that will make things easier for users, and I think thatβs worth the (very small) increase in option complexity. |
maxHeaderSize
to http2
Willing to take up this issue, would be great if I could get some guidance. |
@preyunk I was thinking about working on this, but if you're interested, go ahead! Post your doubts regarding build/ci/code/etc and I'll clarify those for you. βοΈ |
@rexagod I explored the file structure and according to me the related code must be in lib/http.js and lib/internal/http2/util.js or lib/internal/http2/core.js right? |
Also please help me with the part of code which needs to be changed or where the code needs to be added. |
@preyunk To clarify, |
@rexagod so I made changes in |
@rexagod can you check if I am doing the right thing? |
Seeing that you are trying to make your first contribution here, you can use this diff as a reference. Send a draft PR here, after incorporating these changes. We'll add tests then, and/or change existing ones accordingly. Also, please ask here if there's anything you don't understand. diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js
index 8a00cb65e9..40f54e9677 100644
--- a/lib/internal/http2/core.js
+++ b/lib/internal/http2/core.js
@@ -906,6 +906,9 @@ const validateSettings = hideStackFrames((settings) => {
assertWithinRange('maxHeaderListSize',
settings.maxHeaderListSize,
0, kMaxInt);
+ assertWithinRange('maxHeaderSize',
+ settings.maxHeaderSize,
+ 0, kMaxInt);
if (settings.enablePush !== undefined &&
typeof settings.enablePush !== 'boolean') {
throw new ERR_HTTP2_INVALID_SETTING_VALUE('enablePush',
@@ -3112,7 +3115,7 @@ function getUnpackedSettings(buf, options = {}) {
settings.maxFrameSize = value;
break;
case NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE:
- settings.maxHeaderListSize = value;
+ settings.maxHeaderListSize = settings.maxHeaderSize = value;
break;
case NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL:
settings.enableConnectProtocol = value !== 0;
diff --git a/lib/internal/http2/util.js b/lib/internal/http2/util.js
index dcc1355a32..d3852a031d 100644
--- a/lib/internal/http2/util.js
+++ b/lib/internal/http2/util.js
@@ -294,7 +294,7 @@ function getDefaultSettings() {
if ((flags & (1 << IDX_SETTINGS_MAX_HEADER_LIST_SIZE)) ===
(1 << IDX_SETTINGS_MAX_HEADER_LIST_SIZE)) {
- holder.maxHeaderListSize =
+ holder.maxHeaderListSize = holder.maxHeadersSize =
settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE];
}
@@ -322,6 +322,7 @@ function getSettings(session, remote) {
maxFrameSize: settingsBuffer[IDX_SETTINGS_MAX_FRAME_SIZE],
maxConcurrentStreams: settingsBuffer[IDX_SETTINGS_MAX_CONCURRENT_STREAMS],
maxHeaderListSize: settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE],
+ maxHeaderSize: settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE],
enableConnectProtocol:
!!settingsBuffer[IDX_SETTINGS_ENABLE_CONNECT_PROTOCOL]
};
@@ -349,10 +350,13 @@ function updateSettingsBuffer(settings) {
settingsBuffer[IDX_SETTINGS_MAX_FRAME_SIZE] =
settings.maxFrameSize;
}
- if (typeof settings.maxHeaderListSize === 'number') {
+ if (typeof settings.maxHeaderListSize === 'number' ||
+ typeof settings.maxHeaderSize === 'number') {
flags |= (1 << IDX_SETTINGS_MAX_HEADER_LIST_SIZE);
+ // Throw if both are defined and not equal
+ // ie, a fitting header inside `errors.js`
+ // make a new one if no suitable one exists
settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE] =
- settings.maxHeaderListSize;
+ settings.maxHeaderListSize !== undefined ?
+ settings.maxHeaderListSize : settings.maxHeaderSize;
}
if (typeof settings.enablePush === 'boolean') {
flags |= (1 << IDX_SETTINGS_ENABLE_PUSH);
|
@rexagod Looks like I was heading in the right direction but had added some redundant code previously. |
Also I am unable to understand what the lines mentioned below are doing. |
I think Also, |
@rexagod I must write tests for this in |
Actually, for now, just add The buffer we pass into Let's do any further discussions on the PR itself since it's polluting the issue here. |
add maxHeaderSize to http2 as an alias for maxHeaderListSize. Fixes: nodejs#33517
This is a feature request for adding
maxHeaderSize
inhttp2
as quoted belowSounds good to me β
maxHeaderSize
could be added along with that. πOriginally posted by @addaleax in #32388 (comment)
The text was updated successfully, but these errors were encountered: