Package io.github.mahmoudimus.http3
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 QPACKmaxFieldSectionSize- SETTINGS_MAX_FIELD_SECTION_SIZE: the largest field section the sender accepts, counting name + value + 32 per field, orUNLIMITEDqpackBlockedStreams- SETTINGS_QPACK_BLOCKED_STREAMS (RFC 9204 §5): how many streams may be blocked on dynamic table updates at onceenableConnectProtocol- SETTINGS_ENABLE_CONNECT_PROTOCOL (RFC 9220): the sender accepts extended CONNECT requests (with:protocol)h3Datagram- SETTINGS_H3_DATAGRAM (RFC 9297): the sender accepts HTTP Datagramsextensions- 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuildsHttp3Settings, starting from the defaults. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Http3SettingsThe initial values, in force until the peer's SETTINGS frame arrives.static final longstatic final longstatic final longstatic final longstatic final longstatic final longNo limit: the initial value of MAX_FIELD_SECTION_SIZE. -
Constructor Summary
ConstructorsConstructorDescriptionHttp3Settings(long qpackMaxTableCapacity, long maxFieldSectionSize, long qpackBlockedStreams, boolean enableConnectProtocol, boolean h3Datagram, Map<Long, Long> extensions) Creates settings. -
Method Summary
Modifier and TypeMethodDescriptionstatic Http3Settings.Builderbuilder()A builder starting from the defaults.booleanReturns the value of theenableConnectProtocolrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theextensionsrecord component.static Http3SettingsfromFrame(Http3Frame.Settings frame) The settings a peer's SETTINGS frame establishes: its values on top of the defaults.booleanReturns the value of theh3Datagramrecord component.final inthashCode()Returns a hash code value for this object.static booleanisDefined(long id) Whetheridis one of the settings this class has a component for.static booleanisHttp2Reserved(long id) Whetheridis 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).longReturns the value of themaxFieldSectionSizerecord component.longReturns the value of theqpackBlockedStreamsrecord component.longReturns the value of theqpackMaxTableCapacityrecord component.A builder starting from these settings.toFrame()A SETTINGS frame carryingvalues().final StringtoString()Returns a string representation of this record class.static voidvalidate(long id, long value) Checks one received setting.values()The values that differ from the defaults, in identifier order, followed by the extensions: what the SETTINGS frame must carry.
-
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 UNLIMITEDNo limit: the initial value of MAX_FIELD_SECTION_SIZE.- See Also:
-
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-1maxFieldSectionSize- SETTINGS_MAX_FIELD_SECTION_SIZE, 0 to 2^62-1, orUNLIMITEDqpackBlockedStreams- SETTINGS_QPACK_BLOCKED_STREAMS, 0 to 2^62-1enableConnectProtocol- SETTINGS_ENABLE_CONNECT_PROTOCOLh3Datagram- SETTINGS_H3_DATAGRAMextensions- the other settings, in order, copied
-
-
Method Details
-
builder
A builder starting from the defaults.- Returns:
- the builder
-
toBuilder
A builder starting from these settings.- Returns:
- the builder
-
isHttp2Reserved
public static boolean isHttp2Reserved(long id) Whetheridis 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) Whetheridis one of the settings this class has a component for.- Parameters:
id- the setting identifier- Returns:
- whether it has a component
-
validate
Checks one received setting. Unknown identifiers are accepted, since they must be ignored.- Parameters:
id- the setting identifiervalue- 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
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
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
A SETTINGS frame carryingvalues().- Returns:
- the frame
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
qpackMaxTableCapacity
public long qpackMaxTableCapacity()Returns the value of theqpackMaxTableCapacityrecord component.- Returns:
- the value of the
qpackMaxTableCapacityrecord component
-
maxFieldSectionSize
public long maxFieldSectionSize()Returns the value of themaxFieldSectionSizerecord component.- Returns:
- the value of the
maxFieldSectionSizerecord component
-
qpackBlockedStreams
public long qpackBlockedStreams()Returns the value of theqpackBlockedStreamsrecord component.- Returns:
- the value of the
qpackBlockedStreamsrecord component
-
enableConnectProtocol
public boolean enableConnectProtocol()Returns the value of theenableConnectProtocolrecord component.- Returns:
- the value of the
enableConnectProtocolrecord component
-
h3Datagram
public boolean h3Datagram()Returns the value of theh3Datagramrecord component.- Returns:
- the value of the
h3Datagramrecord component
-
extensions
Returns the value of theextensionsrecord component.- Returns:
- the value of the
extensionsrecord component
-