Top Inners Fields Constructors Methods
io.netty.handler.codec.http2

pack-priv final Class HpackDecoder

extends Object
Class Inheritance
Imports
io.netty.buffer.ByteBuf, io.netty.handler.codec.http.HttpHeaderValidationUtil, io.netty.handler.codec.http2.HpackUtil.IndexType, io.netty.util.AsciiString

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
HpackDecoder.HeaderType

HTTP/2 header types.

private static class

Field Summary

Modifier and TypeField and Description
private static final Http2Exception
private static final Http2Exception
private static final Http2Exception
private static final Http2Exception
private long
private final HpackDynamicTable
private final HpackHuffmanDecoder
private static final Http2Exception
private static final Http2Exception
private static final Http2Exception
private long
private boolean
private long
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final Http2Exception

Constructor Summary

AccessConstructor and Description
pack-priv
HpackDecoder(long
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).
maxHeaderListSize
)

Create a new instance.

pack-priv
HpackDecoder(long maxHeaderListSize, int maxHeaderTableSize)

Exposed Used for testing only!

Method Summary

Modifier and TypeMethod and Description
pack-priv void
decode(int streamId, ByteBuf in, Http2Headers headers, boolean validateHeaders)

Decode the header block into header fields.

private void
private void
pack-priv static int
decodeULE128(ByteBuf in, int result)

Unsigned Little Endian Base 128 Variable-Length Integer Encoding

Visible for testing only!

pack-priv static long
decodeULE128(ByteBuf in, long result)

Unsigned Little Endian Base 128 Variable-Length Integer Encoding

Visible for testing only!

pack-priv HpackHeaderField
getHeaderField(int index)

Return the header field at the given index.

private HpackHeaderField
getIndexedHeader(int index)

pack-priv long
pack-priv long
getMaxHeaderTableSize()

Return the maximum table size.

private void
pack-priv int
length()

Return the number of header fields in the dynamic table.

private static IllegalArgumentException
private AsciiString
readName(int index)

private AsciiString
readStringLiteral(ByteBuf in, int length, boolean huffmanEncoded)

private void
setDynamicTableSize(long dynamicTableSize)

pack-priv void
setMaxHeaderListSize(long maxHeaderListSize)

pack-priv void
setMaxHeaderTableSize(long maxHeaderTableSize)

Set the maximum table size.

pack-priv long
size()

Return the size of the dynamic table.

private static HpackDecoder.HeaderType
validateHeader(int streamId, AsciiString name, CharSequence value, HpackDecoder.HeaderType previousHeaderType)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DECODE_ILLEGAL_INDEX_VALUEback to summary
private static final Http2Exception DECODE_ILLEGAL_INDEX_VALUE
DECODE_ULE_128_DECOMPRESSION_EXCEPTIONback to summary
private static final Http2Exception DECODE_ULE_128_DECOMPRESSION_EXCEPTION
DECODE_ULE_128_TO_INT_DECOMPRESSION_EXCEPTIONback to summary
private static final Http2Exception DECODE_ULE_128_TO_INT_DECOMPRESSION_EXCEPTION
DECODE_ULE_128_TO_LONG_DECOMPRESSION_EXCEPTIONback to summary
private static final Http2Exception DECODE_ULE_128_TO_LONG_DECOMPRESSION_EXCEPTION
encoderMaxDynamicTableSizeback to summary
private long encoderMaxDynamicTableSize
hpackDynamicTableback to summary
private final HpackDynamicTable hpackDynamicTable
huffmanDecoderback to summary
private final HpackHuffmanDecoder huffmanDecoder
INDEX_HEADER_ILLEGAL_INDEX_VALUEback to summary
private static final Http2Exception INDEX_HEADER_ILLEGAL_INDEX_VALUE
INVALID_MAX_DYNAMIC_TABLE_SIZEback to summary
private static final Http2Exception INVALID_MAX_DYNAMIC_TABLE_SIZE
MAX_DYNAMIC_TABLE_SIZE_CHANGE_REQUIREDback to summary
private static final Http2Exception MAX_DYNAMIC_TABLE_SIZE_CHANGE_REQUIRED
maxDynamicTableSizeback to summary
private long maxDynamicTableSize
maxDynamicTableSizeChangeRequiredback to summary
private boolean maxDynamicTableSizeChangeRequired
maxHeaderListSizeback to summary
private long maxHeaderListSize
READ_HEADER_REPRESENTATIONback to summary
private static final byte READ_HEADER_REPRESENTATION
READ_INDEXED_HEADERback to summary
private static final byte READ_INDEXED_HEADER
READ_INDEXED_HEADER_NAMEback to summary
private static final byte READ_INDEXED_HEADER_NAME
READ_LITERAL_HEADER_NAMEback to summary
private static final byte READ_LITERAL_HEADER_NAME
READ_LITERAL_HEADER_NAME_LENGTHback to summary
private static final byte READ_LITERAL_HEADER_NAME_LENGTH
READ_LITERAL_HEADER_NAME_LENGTH_PREFIXback to summary
private static final byte READ_LITERAL_HEADER_NAME_LENGTH_PREFIX
READ_LITERAL_HEADER_VALUEback to summary
private static final byte READ_LITERAL_HEADER_VALUE
READ_LITERAL_HEADER_VALUE_LENGTHback to summary
private static final byte READ_LITERAL_HEADER_VALUE_LENGTH
READ_LITERAL_HEADER_VALUE_LENGTH_PREFIXback to summary
private static final byte READ_LITERAL_HEADER_VALUE_LENGTH_PREFIX
READ_NAME_ILLEGAL_INDEX_VALUEback to summary
private static final Http2Exception READ_NAME_ILLEGAL_INDEX_VALUE

Constructor Detail

HpackDecoderback to summary
pack-priv HpackDecoder(long maxHeaderListSize)

Create a new instance.

Parameters
maxHeaderListSize:long

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).

HpackDecoderback to summary
pack-priv HpackDecoder(long maxHeaderListSize, int maxHeaderTableSize)

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.

Method Detail

decodeback to summary
pack-priv void decode(int streamId, ByteBuf in, Http2Headers headers, boolean validateHeaders) throws Http2Exception

Decode the header block into header fields.

This method assumes the entire header block is contained in in.

decodeback to summary
private void decode(ByteBuf in, HpackDecoder.Http2HeadersSink sink) throws Http2Exception
decodeDynamicTableSizeUpdatesback to summary
private void decodeDynamicTableSizeUpdates(ByteBuf in) throws Http2Exception
decodeULE128back to summary
pack-priv static int decodeULE128(ByteBuf in, int result) throws Http2Exception

Unsigned Little Endian Base 128 Variable-Length Integer Encoding

Visible for testing only!

decodeULE128back to summary
pack-priv static long decodeULE128(ByteBuf in, long result) throws Http2Exception

Unsigned Little Endian Base 128 Variable-Length Integer Encoding

Visible for testing only!

getHeaderFieldback to summary
pack-priv HpackHeaderField getHeaderField(int index)

Return the header field at the given index. Exposed for testing.

getIndexedHeaderback to summary
private HpackHeaderField getIndexedHeader(int index) throws Http2Exception
getMaxHeaderListSizeback to summary
pack-priv long getMaxHeaderListSize()
getMaxHeaderTableSizeback to summary
pack-priv long getMaxHeaderTableSize()

Return the maximum table size. This is the maximum size allowed by both the encoder and the decoder.

insertHeaderback to summary
private void insertHeader(HpackDecoder.Http2HeadersSink sink, AsciiString name, AsciiString value, HpackUtil.IndexType indexType)
lengthback to summary
pack-priv int length()

Return the number of header fields in the dynamic table. Exposed for testing.

notEnoughDataExceptionback to summary
private static IllegalArgumentException notEnoughDataException(ByteBuf in)
readNameback to summary
private AsciiString readName(int index) throws Http2Exception
readStringLiteralback to summary
private AsciiString readStringLiteral(ByteBuf in, int length, boolean huffmanEncoded) throws Http2Exception
setDynamicTableSizeback to summary
private void setDynamicTableSize(long dynamicTableSize) throws Http2Exception
setMaxHeaderListSizeback to summary
pack-priv void setMaxHeaderListSize(long maxHeaderListSize) throws Http2Exception
setMaxHeaderTableSizeback to summary
pack-priv void setMaxHeaderTableSize(long maxHeaderTableSize) throws Http2Exception

Set the maximum table size. If this is below the maximum size of the dynamic table used by the encoder, the beginning of the next header block MUST signal this change.

sizeback to summary
pack-priv long size()

Return the size of the dynamic table. Exposed for testing.

validateHeaderback to summary
private static HpackDecoder.HeaderType validateHeader(int streamId, AsciiString name, CharSequence value, HpackDecoder.HeaderType previousHeaderType) throws Http2Exception
io.netty.handler.codec.http2 back to summary

private final Enum HpackDecoder.HeaderType

extends Enum<HpackDecoder.HeaderType>
Class Inheritance

HTTP/2 header types.

Field Summary

Modifier and TypeField and Description
public static final HpackDecoder.HeaderType
public static final HpackDecoder.HeaderType
public static final HpackDecoder.HeaderType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static HpackDecoder.HeaderType
public static HpackDecoder.HeaderType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

REGULAR_HEADERback to summary
public static final HpackDecoder.HeaderType REGULAR_HEADER
REQUEST_PSEUDO_HEADERback to summary
public static final HpackDecoder.HeaderType REQUEST_PSEUDO_HEADER
RESPONSE_PSEUDO_HEADERback to summary
public static final HpackDecoder.HeaderType RESPONSE_PSEUDO_HEADER

Constructor Detail

HeaderTypeback to summary
private HeaderType()

Method Detail

valueOfback to summary
public static HpackDecoder.HeaderType valueOf(String name)
valuesback to summary
public static HpackDecoder.HeaderType[] values()
io.netty.handler.codec.http2 back to summary

private final Class HpackDecoder.Http2HeadersSink

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private boolean
private final Http2Headers
private long
private final long
private HpackDecoder.HeaderType
private final int
private final boolean
private Http2Exception

Constructor Summary

AccessConstructor and Description
pack-priv
Http2HeadersSink(int streamId, Http2Headers headers, long maxHeaderListSize, boolean validateHeaders)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

exceededMaxLengthback to summary
private boolean exceededMaxLength
headersback to summary
private final Http2Headers headers
headersLengthback to summary
private long headersLength
maxHeaderListSizeback to summary
private final long maxHeaderListSize
previousTypeback to summary
private HpackDecoder.HeaderType previousType
streamIdback to summary
private final int streamId
validateHeadersback to summary
private final boolean validateHeaders
validationExceptionback to summary
private Http2Exception validationException

Constructor Detail

Http2HeadersSinkback to summary
pack-priv Http2HeadersSink(int streamId, Http2Headers headers, long maxHeaderListSize, boolean validateHeaders)

Method Detail

appendToHeaderListback to summary
pack-priv void appendToHeaderList(AsciiString name, AsciiString value)
finishback to summary
pack-priv void finish() throws Http2Exception