public class DefaultHttp2HeadersDecoder extends Object implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration
Http2HeadersDecoder.Configuration
Constructor and Description |
---|
DefaultHttp2HeadersDecoder() |
DefaultHttp2HeadersDecoder(boolean validateHeaders)
Create a new instance.
|
DefaultHttp2HeadersDecoder(boolean validateHeaders,
boolean validateHeaderValues)
Create a new instance.
|
DefaultHttp2HeadersDecoder(boolean validateHeaders,
boolean validateHeaderValues,
long maxHeaderListSize)
Create a new instance.
|
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.
|
protected boolean |
validateHeaderValues()
Determines if the header values should be validated as a result of the decode operation.
|
public DefaultHttp2HeadersDecoder()
public DefaultHttp2HeadersDecoder(boolean validateHeaders)
validateHeaders
- true
to validate headers are valid according to the RFC.public DefaultHttp2HeadersDecoder(boolean validateHeaders, boolean validateHeaderValues)
validateHeaders
- true
to validate headers are valid according to the RFC.
This validates everything except header values.validateHeaderValues
- true
to validate that header values are valid according to the RFC.
Since this is potentially expensive, it can be enabled separately from 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, boolean validateHeaderValues, long maxHeaderListSize)
validateHeaders
- true
to validate headers are valid according to the RFC.
This validates everything except header values.validateHeaderValues
- true
to validate that header values are valid according to the RFC.
Since this is potentially expensive, it can be enabled separately from validateHeaders
.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, @Deprecated int initialHuffmanDecodeCapacity)
validateHeaders
- true
to validate headers are valid according to the RFC.
This validates everything except header values.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
- Does nothing, do not use.public void maxHeaderTableSize(long max) throws Http2Exception
Http2HeadersDecoder.Configuration
SETTINGS
frame.maxHeaderTableSize
in interface Http2HeadersDecoder.Configuration
Http2Exception
public long maxHeaderTableSize()
Http2HeadersDecoder.Configuration
Http2CodecUtil.DEFAULT_HEADER_TABLE_SIZE
.maxHeaderTableSize
in interface Http2HeadersDecoder.Configuration
public 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.Configuration
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 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.Configuration
maxHeaderListSize
in interface Http2HeadersDecoder.Configuration
public long maxHeaderListSizeGoAway()
Http2HeadersDecoder.Configuration
GO_AWAY
should be sent.
This will be <=
SETTINGS_MAX_HEADER_LIST_SIZE.maxHeaderListSizeGoAway
in interface Http2HeadersDecoder.Configuration
public Http2HeadersDecoder.Configuration configuration()
Http2HeadersDecoder
Http2HeadersDecoder.Configuration
for this Http2HeadersDecoder
configuration
in interface Http2HeadersDecoder
public Http2Headers decodeHeaders(int streamId, ByteBuf headerBlock) throws Http2Exception
Http2HeadersDecoder
decodeHeaders
in interface Http2HeadersDecoder
Http2Exception
protected final int numberOfHeadersGuess()
protected final boolean validateHeaders()
Note: This does not include validation of header values, since that is potentially expensive to do. Value validation is instead enabled separately.
true
if the headers should be validated as a result of the decode operation.protected boolean validateHeaderValues()
Note: This only validates the values of headers. All other header validations are instead enabled separately.
true
if the header values 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.Copyright © 2008–2024 The Netty Project. All rights reserved.