@UnstableApi public class DefaultHttp2HeadersDecoder extends java.lang.Object implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration
Http2HeadersDecoder.Configuration| Modifier and Type | Field and Description |
|---|---|
private float |
headerArraySizeAccumulator
Used to calculate an exponential moving average of header sizes to get an estimate of how large the data
structure for storing headers should be.
|
private static float |
HEADERS_COUNT_WEIGHT_HISTORICAL |
private static float |
HEADERS_COUNT_WEIGHT_NEW |
private HpackDecoder |
hpackDecoder |
private boolean |
validateHeaders |
| Constructor and Description |
|---|
DefaultHttp2HeadersDecoder() |
DefaultHttp2HeadersDecoder(boolean validateHeaders) |
DefaultHttp2HeadersDecoder(boolean validateHeaders,
HpackDecoder hpackDecoder)
Exposed Used for testing only! Default values used in the initial settings frame are overridden intentionally
for testing but violate the RFC if used outside the scope of testing.
|
DefaultHttp2HeadersDecoder(boolean validateHeaders,
long maxHeaderListSize)
Create a new instance.
|
DefaultHttp2HeadersDecoder(boolean validateHeaders,
long maxHeaderListSize,
int initialHuffmanDecodeCapacity)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
Http2HeadersDecoder.Configuration |
configuration()
Get the
Http2HeadersDecoder.Configuration for this Http2HeadersDecoder |
Http2Headers |
decodeHeaders(int streamId,
ByteBuf 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 a
GO_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 new
Http2Headers 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.
|
private static final float HEADERS_COUNT_WEIGHT_NEW
private static final float HEADERS_COUNT_WEIGHT_HISTORICAL
private final HpackDecoder hpackDecoder
private final boolean validateHeaders
private float headerArraySizeAccumulator
public DefaultHttp2HeadersDecoder()
public DefaultHttp2HeadersDecoder(boolean validateHeaders)
public DefaultHttp2HeadersDecoder(boolean validateHeaders,
long maxHeaderListSize)
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).public DefaultHttp2HeadersDecoder(boolean validateHeaders,
long maxHeaderListSize,
int initialHuffmanDecodeCapacity)
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).initialHuffmanDecodeCapacity - Size of an intermediate buffer used during huffman decode.DefaultHttp2HeadersDecoder(boolean validateHeaders,
HpackDecoder hpackDecoder)
public void maxHeaderTableSize(long max)
throws Http2Exception
Http2HeadersDecoder.ConfigurationSETTINGS frame.maxHeaderTableSize in interface Http2HeadersDecoder.ConfigurationHttp2Exceptionpublic long maxHeaderTableSize()
Http2HeadersDecoder.ConfigurationHttp2CodecUtil.DEFAULT_HEADER_TABLE_SIZE.maxHeaderTableSize in interface Http2HeadersDecoder.Configurationpublic void maxHeaderListSize(long max,
long goAwayMax)
throws Http2Exception
Http2HeadersDecoder.Configuration
This method should only be called by Netty (not users) as a result of a receiving a SETTINGS frame.
maxHeaderListSize in interface Http2HeadersDecoder.Configurationmax - 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 a RST_STREAM frame will be sent for the offending stream.goAwayMax - Must be >= max. A GO_AWAY frame will be generated if this limit is exceeded
for any particular stream.Http2Exception - if limits exceed the RFC's boundaries or max > goAwayMax.public long maxHeaderListSize()
Http2HeadersDecoder.ConfigurationmaxHeaderListSize in interface Http2HeadersDecoder.Configurationpublic long maxHeaderListSizeGoAway()
Http2HeadersDecoder.ConfigurationGO_AWAY should be sent.
This will be <=
SETTINGS_MAX_HEADER_LIST_SIZE.maxHeaderListSizeGoAway in interface Http2HeadersDecoder.Configurationpublic Http2HeadersDecoder.Configuration configuration()
Http2HeadersDecoderHttp2HeadersDecoder.Configuration for this Http2HeadersDecoderconfiguration in interface Http2HeadersDecoderpublic Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception
Http2HeadersDecoderdecodeHeaders in interface Http2HeadersDecoderHttp2Exceptionprotected final int numberOfHeadersGuess()
protected final boolean validateHeaders()
true if the headers should be validated as a result of the decode operation.protected Http2Headers newHeaders()
Http2Headers object which will store the results of the decode operation.Http2Headers object which will store the results of the decode operation.