- java.lang.Object
-
- io.netty5.handler.codec.http2.DefaultHttp2HeadersDecoder
-
- All Implemented Interfaces:
Http2HeadersDecoder,Http2HeadersDecoder.Configuration
@UnstableApi public class DefaultHttp2HeadersDecoder extends Object implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.netty5.handler.codec.http2.Http2HeadersDecoder
Http2HeadersDecoder.Configuration
-
-
Constructor Summary
Constructors Constructor Description DefaultHttp2HeadersDecoder()DefaultHttp2HeadersDecoder(boolean validateHeaders)DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize)Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Http2HeadersDecoder.Configurationconfiguration()Get theHttp2HeadersDecoder.Configurationfor thisHttp2HeadersDecoderHttp2HeadersdecodeHeaders(int streamId, Buffer headerBlock)Decodes the given headers block and returns the headers.longmaxHeaderListSize()Represents the value for SETTINGS_MAX_HEADER_LIST_SIZE.voidmaxHeaderListSize(long max, long goAwayMax)Configure the maximum allowed size in bytes of each set of headers.longmaxHeaderListSizeGoAway()Represents the upper bound in bytes for a set of headers before aGO_AWAYshould be sent.longmaxHeaderTableSize()Represents the value for SETTINGS_HEADER_TABLE_SIZE.voidmaxHeaderTableSize(long max)Represents the value for SETTINGS_HEADER_TABLE_SIZE.protected Http2HeadersnewHeaders()Create a newHttp2Headersobject which will store the results of the decode operation.protected intnumberOfHeadersGuess()A weighted moving average estimating how many headers are expected during the decode process.protected booleanvalidateHeaders()Determines if the headers should be validated as a result of the decode operation.
-
-
-
Constructor Detail
-
DefaultHttp2HeadersDecoder
public DefaultHttp2HeadersDecoder()
-
DefaultHttp2HeadersDecoder
public DefaultHttp2HeadersDecoder(boolean validateHeaders)
-
DefaultHttp2HeadersDecoder
public DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize)Create a new instance.- Parameters:
validateHeaders-trueto validate headers are valid according to the RFC.maxHeaderListSize- This is the only setting that can be configured before notifying the peer. This is because SETTINGS_MAX_HEADER_LIST_SIZE allows a lower than advertised limit from being enforced, and the default limit is unlimited (which is dangerous).
-
-
Method Detail
-
maxHeaderTableSize
public void maxHeaderTableSize(long max) throws Http2ExceptionDescription copied from interface:Http2HeadersDecoder.ConfigurationRepresents the value for SETTINGS_HEADER_TABLE_SIZE. This method should only be called by Netty (not users) as a result of a receiving aSETTINGSframe.- Specified by:
maxHeaderTableSizein interfaceHttp2HeadersDecoder.Configuration- Throws:
Http2Exception
-
maxHeaderTableSize
public long maxHeaderTableSize()
Description copied from interface:Http2HeadersDecoder.ConfigurationRepresents the value for SETTINGS_HEADER_TABLE_SIZE. The initial value returned by this method must beHttp2CodecUtil.DEFAULT_HEADER_TABLE_SIZE.- Specified by:
maxHeaderTableSizein interfaceHttp2HeadersDecoder.Configuration
-
maxHeaderListSize
public void maxHeaderListSize(long max, long goAwayMax) throws Http2ExceptionDescription copied from interface:Http2HeadersDecoder.ConfigurationConfigure the maximum allowed size in bytes of each set of headers.This method should only be called by Netty (not users) as a result of a receiving a
SETTINGSframe.- Specified by:
maxHeaderListSizein interfaceHttp2HeadersDecoder.Configuration- Parameters:
max- SETTINGS_MAX_HEADER_LIST_SIZE. If this limit is exceeded the implementation should attempt to keep the HPACK header tables up to date by processing data from the peer, but aRST_STREAMframe will be sent for the offending stream.goAwayMax- Must be>= max. AGO_AWAYframe will be generated if this limit is exceeded for any particular stream.- Throws:
Http2Exception- if limits exceed the RFC's boundaries ormax > goAwayMax.
-
maxHeaderListSize
public long maxHeaderListSize()
Description copied from interface:Http2HeadersDecoder.ConfigurationRepresents the value for SETTINGS_MAX_HEADER_LIST_SIZE.- Specified by:
maxHeaderListSizein interfaceHttp2HeadersDecoder.Configuration
-
maxHeaderListSizeGoAway
public long maxHeaderListSizeGoAway()
Description copied from interface:Http2HeadersDecoder.ConfigurationRepresents the upper bound in bytes for a set of headers before aGO_AWAYshould be sent. This will be<=SETTINGS_MAX_HEADER_LIST_SIZE.- Specified by:
maxHeaderListSizeGoAwayin interfaceHttp2HeadersDecoder.Configuration
-
configuration
public Http2HeadersDecoder.Configuration configuration()
Description copied from interface:Http2HeadersDecoderGet theHttp2HeadersDecoder.Configurationfor thisHttp2HeadersDecoder- Specified by:
configurationin interfaceHttp2HeadersDecoder
-
decodeHeaders
public Http2Headers decodeHeaders(int streamId, Buffer headerBlock) throws Http2Exception
Description copied from interface:Http2HeadersDecoderDecodes the given headers block and returns the headers.- Specified by:
decodeHeadersin interfaceHttp2HeadersDecoder- Throws:
Http2Exception
-
numberOfHeadersGuess
protected final int numberOfHeadersGuess()
A weighted moving average estimating how many headers are expected during the decode process.- Returns:
- an estimate of how many headers are expected during the decode process.
-
validateHeaders
protected final boolean validateHeaders()
Determines if the headers should be validated as a result of the decode operation.- Returns:
trueif the headers should be validated as a result of the decode operation.
-
newHeaders
protected Http2Headers newHeaders()
Create a newHttp2Headersobject which will store the results of the decode operation.- Returns:
- a new
Http2Headersobject which will store the results of the decode operation.
-
-