Skip to content

Comments

feat(node): implement HTTP/2 settings API (getDefaultSettings, getPackedSettings, getUnpackedSettings)#32275

Open
dive2tech wants to merge 1 commit intodenoland:mainfrom
dive2tech:feat/node-http2-settings-api
Open

feat(node): implement HTTP/2 settings API (getDefaultSettings, getPackedSettings, getUnpackedSettings)#32275
dive2tech wants to merge 1 commit intodenoland:mainfrom
dive2tech:feat/node-http2-settings-api

Conversation

@dive2tech
Copy link

Summary

Implements the Node.js-compatible HTTP/2 settings API for node:http2:

  • http2.getDefaultSettings() – Returns default HTTP/2 settings (RFC 7540 + Node.js defaults).
  • http2.getPackedSettings(settings) – Packs a settings object into a Buffer for the HTTP2-Settings header (6 bytes per setting: 16-bit ID + 32-bit value, big-endian).
  • http2.getUnpackedSettings(buffer) – Unpacks a Buffer or TypedArray of packed settings into an object.

Changes

  • New: ext/node/polyfills/internal/http2/settings.ts – Encoding/decoding and validation per RFC 7540; supports known settings (headerTableSize, enablePush, maxConcurrentStreams, initialWindowSize, maxFrameSize, maxHeaderListSize, enableConnectProtocol) and numeric IDs for unknown settings.
  • Updated: ext/node/polyfills/http2.ts – Replaces notImplemented stubs with the new implementation.
  • Updated: tools/core_import_map.json – Registers the new internal settings module.
  • New: tests/unit_node/http2_settings_test.ts – Tests for defaults, roundtrip, validation (enablePush 0/1, maxFrameSize bounds, initialWindowSize max, etc.), invalid inputs, and packed format.

Compatibility

  • Defaults and packed format align with Node.js and RFC 7540.
  • Validation (non-negative integers, enablePush/enableConnectProtocol 0 or 1, maxFrameSize 16384–16777215, initialWindowSize ≤ 2^31-1) matches Node behavior.

@CLAassistant
Copy link

CLAassistant commented Feb 23, 2026

CLA assistant check
All committers have signed the CLA.

@dive2tech dive2tech force-pushed the feat/node-http2-settings-api branch 2 times, most recently from 042e4fc to 4cc3648 Compare February 23, 2026 06:35
…kedSettings, getUnpackedSettings)

Co-authored-by: Cursor <cursoragent@cursor.com>
@dive2tech dive2tech force-pushed the feat/node-http2-settings-api branch from 6c9be96 to 981536b Compare February 23, 2026 07:41
@bartlomieju
Copy link
Member

Thanks for the PR, but there's little chance we will merge it. We are already working on node:http2 support in #30955, which is a multi-month project and would cause conflicts.

Next time, please open an issue first to discuss if someone else has already tackled this work.

@dive2tech
Copy link
Author

Hi @bartlomieju,

I’ve added the HTTP/2 settings.
When you have a moment, please take a look.

If everything looks good, feel free to merge it, or let me know if I should close it.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants