- 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.Configuration
configuration()
Get theHttp2HeadersDecoder.Configuration
for thisHttp2HeadersDecoder
Http2Headers
decodeHeaders(int streamId, Buffer headerBlock)
Decodes the given headers block and returns the headers.long
maxHeaderListSize()
Represents the value for SETTINGS_MAX_HEADER_LIST_SIZE.void
maxHeaderListSize(long max, long goAwayMax)
Configure the maximum allowed size in bytes of each set of headers.long
maxHeaderListSizeGoAway()
Represents the upper bound in bytes for a set of headers before aGO_AWAY
should be sent.long
maxHeaderTableSize()
Represents the value for SETTINGS_HEADER_TABLE_SIZE.void
maxHeaderTableSize(long max)
Represents the value for SETTINGS_HEADER_TABLE_SIZE.protected Http2Headers
newHeaders()
Create a newHttp2Headers
object which will store the results of the decode operation.protected int
numberOfHeadersGuess()
A weighted moving average estimating how many headers are expected during the decode process.protected boolean
validateHeaders()
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
-true
to 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 Http2Exception
Description copied from interface:Http2HeadersDecoder.Configuration
Represents the value for SETTINGS_HEADER_TABLE_SIZE. This method should only be called by Netty (not users) as a result of a receiving aSETTINGS
frame.- Specified by:
maxHeaderTableSize
in interfaceHttp2HeadersDecoder.Configuration
- Throws:
Http2Exception
-
maxHeaderTableSize
public long maxHeaderTableSize()
Description copied from interface:Http2HeadersDecoder.Configuration
Represents the value for SETTINGS_HEADER_TABLE_SIZE. The initial value returned by this method must beHttp2CodecUtil.DEFAULT_HEADER_TABLE_SIZE
.- Specified by:
maxHeaderTableSize
in interfaceHttp2HeadersDecoder.Configuration
-
maxHeaderListSize
public void maxHeaderListSize(long max, long goAwayMax) throws Http2Exception
Description copied from interface:Http2HeadersDecoder.Configuration
Configure 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
SETTINGS
frame.- Specified by:
maxHeaderListSize
in 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_STREAM
frame will be sent for the offending stream.goAwayMax
- Must be>= max
. AGO_AWAY
frame 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.Configuration
Represents the value for SETTINGS_MAX_HEADER_LIST_SIZE.- Specified by:
maxHeaderListSize
in interfaceHttp2HeadersDecoder.Configuration
-
maxHeaderListSizeGoAway
public long maxHeaderListSizeGoAway()
Description copied from interface:Http2HeadersDecoder.Configuration
Represents the upper bound in bytes for a set of headers before aGO_AWAY
should be sent. This will be<=
SETTINGS_MAX_HEADER_LIST_SIZE.- Specified by:
maxHeaderListSizeGoAway
in interfaceHttp2HeadersDecoder.Configuration
-
configuration
public Http2HeadersDecoder.Configuration configuration()
Description copied from interface:Http2HeadersDecoder
Get theHttp2HeadersDecoder.Configuration
for thisHttp2HeadersDecoder
- Specified by:
configuration
in interfaceHttp2HeadersDecoder
-
decodeHeaders
public Http2Headers decodeHeaders(int streamId, Buffer headerBlock) throws Http2Exception
Description copied from interface:Http2HeadersDecoder
Decodes the given headers block and returns the headers.- Specified by:
decodeHeaders
in 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:
true
if the headers should be validated as a result of the decode operation.
-
newHeaders
protected Http2Headers newHeaders()
Create a newHttp2Headers
object which will store the results of the decode operation.- Returns:
- a new
Http2Headers
object which will store the results of the decode operation.
-
-