Record Class Http3Settings

java.lang.Object
java.lang.Record
io.github.mahmoudimus.http3.Http3Settings
Record Components:
qpackMaxTableCapacity - SETTINGS_QPACK_MAX_TABLE_CAPACITY (RFC 9204 §5): the largest QPACK dynamic table the sender's decoder accepts; 0 means static-table-only QPACK
maxFieldSectionSize - SETTINGS_MAX_FIELD_SECTION_SIZE: the largest field section the sender accepts, counting name + value + 32 per field, or UNLIMITED
qpackBlockedStreams - SETTINGS_QPACK_BLOCKED_STREAMS (RFC 9204 §5): how many streams may be blocked on dynamic table updates at once
enableConnectProtocol - SETTINGS_ENABLE_CONNECT_PROTOCOL (RFC 9220): the sender accepts extended CONNECT requests (with :protocol)
h3Datagram - SETTINGS_H3_DATAGRAM (RFC 9297): the sender accepts HTTP Datagrams
extensions - settings with any other identifier (extensions, and the reserved 0x1f * N + 0x21 used for greasing) in the order received; they have no effect here and are kept so they can be relayed

public record Http3Settings(long qpackMaxTableCapacity, long maxFieldSectionSize, long qpackBlockedStreams, boolean enableConnectProtocol, boolean h3Datagram, Map<Long,Long> extensions) extends Record
The SETTINGS parameters of one endpoint (RFC 9114 §7.2.4). Immutable; the constructor and Http3Settings.Builder.build() reject values the protocol does not allow with IllegalArgumentException, and fromFrame(Http3Frame.Settings) rejects a peer's invalid values with the Http3Exception the protocol requires.

Unlike HTTP/2, each endpoint sends SETTINGS exactly once, as the first frame of its control stream, and nothing acknowledges it. DEFAULT holds the initial values, which apply until the peer's SETTINGS arrive.

  • Field Details

    • QPACK_MAX_TABLE_CAPACITY

      public static final long QPACK_MAX_TABLE_CAPACITY
      See Also:
    • MAX_FIELD_SECTION_SIZE

      public static final long MAX_FIELD_SECTION_SIZE
      See Also:
    • QPACK_BLOCKED_STREAMS

      public static final long QPACK_BLOCKED_STREAMS
      See Also:
    • ENABLE_CONNECT_PROTOCOL

      public static final long ENABLE_CONNECT_PROTOCOL
      See Also:
    • H3_DATAGRAM

      public static final long H3_DATAGRAM
      See Also:
    • UNLIMITED

      public static final long UNLIMITED
      No limit: the initial value of MAX_FIELD_SECTION_SIZE.
      See Also:
    • DEFAULT

      public static final Http3Settings DEFAULT
      The initial values, in force until the peer's SETTINGS frame arrives.
  • Constructor Details

    • Http3Settings

      public Http3Settings(long qpackMaxTableCapacity, long maxFieldSectionSize, long qpackBlockedStreams, boolean enableConnectProtocol, boolean h3Datagram, Map<Long,Long> extensions)
      Creates settings.
      Parameters:
      qpackMaxTableCapacity - SETTINGS_QPACK_MAX_TABLE_CAPACITY, 0 to 2^62-1
      maxFieldSectionSize - SETTINGS_MAX_FIELD_SECTION_SIZE, 0 to 2^62-1, or UNLIMITED
      qpackBlockedStreams - SETTINGS_QPACK_BLOCKED_STREAMS, 0 to 2^62-1
      enableConnectProtocol - SETTINGS_ENABLE_CONNECT_PROTOCOL
      h3Datagram - SETTINGS_H3_DATAGRAM
      extensions - the other settings, in order, copied
  • Method Details

    • builder

      public static Http3Settings.Builder builder()
      A builder starting from the defaults.
      Returns:
      the builder
    • toBuilder

      public Http3Settings.Builder toBuilder()
      A builder starting from these settings.
      Returns:
      the builder
    • isHttp2Reserved

      public static boolean isHttp2Reserved(long id)
      Whether id is an HTTP/2 setting with no HTTP/3 counterpart (0x00, 0x02, 0x03, 0x04 and 0x05), which must not be sent; receiving one is a connection error H3_SETTINGS_ERROR (RFC 9114 §7.2.4.1).
      Parameters:
      id - the setting identifier
      Returns:
      whether HTTP/3 forbids it
    • isDefined

      public static boolean isDefined(long id)
      Whether id is one of the settings this class has a component for.
      Parameters:
      id - the setting identifier
      Returns:
      whether it has a component
    • validate

      public static void validate(long id, long value) throws Http3Exception
      Checks one received setting. Unknown identifiers are accepted, since they must be ignored.
      Parameters:
      id - the setting identifier
      value - its value
      Throws:
      Http3Exception - a connection error H3_SETTINGS_ERROR for an HTTP/2-only identifier, or for ENABLE_CONNECT_PROTOCOL or H3_DATAGRAM other than 0 or 1
    • fromFrame

      public static Http3Settings fromFrame(Http3Frame.Settings frame) throws Http3Exception
      The settings a peer's SETTINGS frame establishes: its values on top of the defaults.
      Parameters:
      frame - the peer's SETTINGS frame
      Returns:
      the settings
      Throws:
      Http3Exception - a connection error H3_SETTINGS_ERROR for an invalid setting
    • values

      public Map<Long,Long> values()
      The values that differ from the defaults, in identifier order, followed by the extensions: what the SETTINGS frame must carry.
      Returns:
      the identifiers and values, in order
    • toFrame

      public Http3Frame.Settings toFrame()
      A SETTINGS frame carrying values().
      Returns:
      the frame
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • qpackMaxTableCapacity

      public long qpackMaxTableCapacity()
      Returns the value of the qpackMaxTableCapacity record component.
      Returns:
      the value of the qpackMaxTableCapacity record component
    • maxFieldSectionSize

      public long maxFieldSectionSize()
      Returns the value of the maxFieldSectionSize record component.
      Returns:
      the value of the maxFieldSectionSize record component
    • qpackBlockedStreams

      public long qpackBlockedStreams()
      Returns the value of the qpackBlockedStreams record component.
      Returns:
      the value of the qpackBlockedStreams record component
    • enableConnectProtocol

      public boolean enableConnectProtocol()
      Returns the value of the enableConnectProtocol record component.
      Returns:
      the value of the enableConnectProtocol record component
    • h3Datagram

      public boolean h3Datagram()
      Returns the value of the h3Datagram record component.
      Returns:
      the value of the h3Datagram record component
    • extensions

      public Map<Long,Long> extensions()
      Returns the value of the extensions record component.
      Returns:
      the value of the extensions record component