设置对象


¥Settings object

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

¥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> 指定用于标头压缩的最大字节数。最小允许值为 0。允许的最大值为 232-1。默认值:4096

    ¥headerTableSize <number> Specifies the maximum number of bytes used for header compression. The minimum allowed value is 0. The maximum allowed value is 232-1. Default: 4096.

  • enablePush <boolean> 如果在 Http2Session 实例上允许 HTTP/2 推送流,则指定 true。默认值:true

    ¥enablePush <boolean> Specifies true if HTTP/2 Push Streams are to be permitted on the Http2Session instances. Default: true.

  • initialWindowSize <number> 为流级流量控制指定发送方的初始窗口大小(以字节为单位)。最小允许值为 0。允许的最大值为 232-1。默认值:65535

    ¥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> 指定最大帧有效载荷的字节大小。最小允许值为 16,384。允许的最大值为 224-1。默认值:16384

    ¥maxFrameSize <number> Specifies the size in bytes of the largest frame payload. The minimum allowed value is 16,384. The maximum allowed value is 224-1. Default: 16384.

  • maxConcurrentStreams <number> 指定 Http2Session 上允许的最大并发流数。没有默认值,这意味着至少在理论上,在 Http2Session 中的任何给定时间可以同时打开 232-1 个流。最小值为 0。允许的最大值为 232-1。默认值:4294967295

    ¥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> 指定将被接受的标头列表的最大大小(未压缩的八位字节)。最小允许值为 0。允许的最大值为 232-1。默认值:65535

    ¥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 232-1. Default: 65535.

  • maxHeaderSize <number> maxHeaderListSize 的别名。

    ¥maxHeaderSize <number> Alias for maxHeaderListSize.

  • enableConnectProtocol <boolean> 如果要启用 RFC 8441 定义的 "扩展连接协议",则指定 true。此设置仅在服务器发送时才有意义。一旦为给定的 Http2Session 启用了 enableConnectProtocol 设置,就无法禁用它。默认值:false

    ¥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.

  • customSettings <Object> 指定其他设置,但尚未在节点和底层库中实现。对象的键定义设置类型的数值(如 [RFC 7540] 建立的 "HTTP/2 SETTINGS" 注册表中所定义)以及设置的实际数值。设置类型必须是 1 到 2^16-1 范围内的整数。它不应该是节点已经处理的设置类型,即当前它应该大于 6,尽管它不是错误。这些值必须是 0 到 2^32-1 范围内的无符号整数。目前最多支持 10 个自定义设置。仅支持发送设置,或接收服务器或客户端对象的 remoteCustomSettings 选项中指定的设置值。不要将设置 id 的 customSettings 机制与原生处理的设置的接口混合在一起,以防将来的节点版本原生支持某个设置。

    ¥customSettings <Object> Specifies additional settings, yet not implemented in node and the underlying libraries. The key of the object defines the numeric value of the settings type (as defined in the "HTTP/2 SETTINGS" registry established by [RFC 7540]) and the values the actual numeric value of the settings. The settings type has to be an integer in the range from 1 to 2^16-1. It should not be a settings type already handled by node, i.e. currently it should be greater than 6, although it is not an error. The values need to be unsigned integers in the range from 0 to 2^32-1. Currently, a maximum of up 10 custom settings is supported. It is only supported for sending SETTINGS, or for receiving settings values specified in the remoteCustomSettings options of the server or client object. Do not mix the customSettings-mechanism for a settings id with interfaces for the natively handled settings, in case a setting becomes natively supported in a future node version.

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

¥All additional properties on the settings object are ignored.