设置对象


http2.getDefaultSettings()http2.getPackedSettings()http2.createServer()http2.createSecureServer()http2session.settings()http2session.localSettingshttp2session.remoteSettings API 返回或接收一个对象作为输入,该对象定义了 Http2Session 对象的配置设置。 这些对象是包含以下属性的普通 JavaScript 对象。

  • headerTableSize <number> 指定用于标头压缩的最大字节数。 最小允许值为 0。 最大允许值为 232-1。 默认值: 4096
  • enablePush <boolean> 如果在 Http2Session 实例上允许 HTTP/2 推送流,则指定 true默认值: true
  • initialWindowSize <number> 指定_发送者的_初始窗口大小(以字节为单位),用于流级流量控制。 最小允许值为 0。 最大允许值为 232-1。 默认值: 65535
  • maxFrameSize <number> 指定最大帧有效载荷的字节大小。 最小允许值为 16,384。 最大允许值为 224-1。 默认值: 16384
  • maxConcurrentStreams <number> 指定 Http2Session 上允许的最大并发流数。 没有默认值意味着,至少在理论上,232-1 个流可以在 Http2Session 中的任何给定时间同时打开。 最小值为 0。 最大允许值为 232-1。 默认值: 4294967295
  • maxHeaderListSize <number> 指定将被接受的标头列表的最大大小(未压缩的八位字节)。 最小允许值为 0。 最大允许值为 232-1。 默认值: 65535
  • maxHeaderSize <number> maxHeaderListSize 的别名。
  • enableConnectProtocol<boolean> 如果要启用由 RFC 8441 定义的"扩展连接协议",则指定 true。 此设置仅在服务器发送时才有意义。 一旦为给定的 Http2Session 启用了 enableConnectProtocol 设置,就无法禁用它。 默认值: false

设置对象上的所有附加属性都将被忽略。

The http2.getDefaultSettings(), http2.getPackedSettings(), http2.createServer(), http2.createSecureServer(), http2session.settings(), http2session.localSettings, and http2session.remoteSettings APIs either return or receive as input an object that defines configuration settings for an Http2Session object. These objects are ordinary JavaScript objects containing the following properties.

  • headerTableSize <number> Specifies the maximum number of bytes used for header compression. The minimum allowed value is 0. The maximum allowed value is 2232-1. Default: 4096.
  • enablePush <boolean> Specifies true if HTTP/2 Push Streams are to be permitted on the Http2Session instances. Default: true.
  • initialWindowSize <number> Specifies the sender's initial window size in bytes for stream-level flow control. The minimum allowed value is 0. The maximum allowed value is 232-1. Default: 65535.
  • maxFrameSize <number> Specifies the size in bytes of the largest frame payload. The minimum allowed value is 16,384. The maximum allowed value is 2224-1. Default: 16384.
  • maxConcurrentStreams <number> Specifies the maximum number of concurrent streams permitted on an Http2Session. There is no default value which implies, at least theoretically, 232-1 streams may be open concurrently at any given time in an Http2Session. The minimum value is 0. The maximum allowed value is 232-1. Default: 4294967295.
  • maxHeaderListSize <number> Specifies the maximum size (uncompressed octets) of header list that will be accepted. The minimum allowed value is 0. The maximum allowed value is 2232-1. Default: 65535.
  • maxHeaderSize <number> Alias for maxHeaderListSize.
  • enableConnectProtocol<boolean> Specifies true if the "Extended Connect Protocol" defined by RFC 8441 is to be enabled. This setting is only meaningful if sent by the server. Once the enableConnectProtocol setting has been enabled for a given Http2Session, it cannot be disabled. Default: false.

All additional properties on the settings object are ignored.