final class HpackDecoder
extends java.lang.Object
Constructor and Description |
---|
HpackDecoder(long maxHeaderListSize,
int initialHuffmanDecodeCapacity)
Create a new instance.
|
HpackDecoder(long maxHeaderListSize,
int initialHuffmanDecodeCapacity,
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.
|
Modifier and Type | Method and Description |
---|---|
private long |
addHeader(int streamId,
Http2Headers headers,
java.lang.CharSequence name,
java.lang.CharSequence value,
long headersLength) |
void |
decode(int streamId,
ByteBuf in,
Http2Headers headers)
Decode the header block into header fields.
|
(package private) static int |
decodeULE128(ByteBuf in,
int result)
Unsigned Little Endian Base 128 Variable-Length Integer Encoding
|
(package private) static long |
decodeULE128(ByteBuf in,
long result)
Unsigned Little Endian Base 128 Variable-Length Integer Encoding
|
(package private) HpackHeaderField |
getHeaderField(int index)
Return the header field at the given index.
|
long |
getMaxHeaderListSize() |
long |
getMaxHeaderListSizeGoAway() |
long |
getMaxHeaderTableSize()
Return the maximum table size.
|
private long |
indexHeader(int streamId,
int index,
Http2Headers headers,
long headersLength) |
private long |
insertHeader(int streamId,
Http2Headers headers,
java.lang.CharSequence name,
java.lang.CharSequence value,
HpackUtil.IndexType indexType,
long headerSize) |
(package private) int |
length()
Return the number of header fields in the dynamic table.
|
private static java.lang.IllegalArgumentException |
notEnoughDataException(ByteBuf in) |
private java.lang.CharSequence |
readName(int index) |
private java.lang.CharSequence |
readStringLiteral(ByteBuf in,
int length,
boolean huffmanEncoded) |
private void |
setDynamicTableSize(long dynamicTableSize) |
void |
setMaxHeaderListSize(long maxHeaderListSize,
long maxHeaderListSizeGoAway) |
void |
setMaxHeaderTableSize(long maxHeaderTableSize)
Set the maximum table size.
|
(package private) long |
size()
Return the size of the dynamic table.
|
private static final Http2Exception DECODE_ULE_128_DECOMPRESSION_EXCEPTION
private static final Http2Exception DECODE_ULE_128_TO_LONG_DECOMPRESSION_EXCEPTION
private static final Http2Exception DECODE_ULE_128_TO_INT_DECOMPRESSION_EXCEPTION
private static final Http2Exception DECODE_ILLEGAL_INDEX_VALUE
private static final Http2Exception INDEX_HEADER_ILLEGAL_INDEX_VALUE
private static final Http2Exception READ_NAME_ILLEGAL_INDEX_VALUE
private static final Http2Exception INVALID_MAX_DYNAMIC_TABLE_SIZE
private static final Http2Exception MAX_DYNAMIC_TABLE_SIZE_CHANGE_REQUIRED
private static final byte READ_HEADER_REPRESENTATION
private static final byte READ_MAX_DYNAMIC_TABLE_SIZE
private static final byte READ_INDEXED_HEADER
private static final byte READ_INDEXED_HEADER_NAME
private static final byte READ_LITERAL_HEADER_NAME_LENGTH_PREFIX
private static final byte READ_LITERAL_HEADER_NAME_LENGTH
private static final byte READ_LITERAL_HEADER_NAME
private static final byte READ_LITERAL_HEADER_VALUE_LENGTH_PREFIX
private static final byte READ_LITERAL_HEADER_VALUE_LENGTH
private static final byte READ_LITERAL_HEADER_VALUE
private final HpackDynamicTable hpackDynamicTable
private final HpackHuffmanDecoder hpackHuffmanDecoder
private long maxHeaderListSizeGoAway
private long maxHeaderListSize
private long maxDynamicTableSize
private long encoderMaxDynamicTableSize
private boolean maxDynamicTableSizeChangeRequired
HpackDecoder(long maxHeaderListSize, int initialHuffmanDecodeCapacity)
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.HpackDecoder(long maxHeaderListSize, int initialHuffmanDecodeCapacity, int maxHeaderTableSize)
public void decode(int streamId, ByteBuf in, Http2Headers headers) throws Http2Exception
This method assumes the entire header block is contained in in
.
Http2Exception
public void setMaxHeaderTableSize(long maxHeaderTableSize) throws Http2Exception
Http2Exception
public void setMaxHeaderListSize(long maxHeaderListSize, long maxHeaderListSizeGoAway) throws Http2Exception
Http2Exception
public long getMaxHeaderListSize()
public long getMaxHeaderListSizeGoAway()
public long getMaxHeaderTableSize()
int length()
long size()
HpackHeaderField getHeaderField(int index)
private void setDynamicTableSize(long dynamicTableSize) throws Http2Exception
Http2Exception
private java.lang.CharSequence readName(int index) throws Http2Exception
Http2Exception
private long indexHeader(int streamId, int index, Http2Headers headers, long headersLength) throws Http2Exception
Http2Exception
private long insertHeader(int streamId, Http2Headers headers, java.lang.CharSequence name, java.lang.CharSequence value, HpackUtil.IndexType indexType, long headerSize) throws Http2Exception
Http2Exception
private long addHeader(int streamId, Http2Headers headers, java.lang.CharSequence name, java.lang.CharSequence value, long headersLength) throws Http2Exception
Http2Exception
private java.lang.CharSequence readStringLiteral(ByteBuf in, int length, boolean huffmanEncoded) throws Http2Exception
Http2Exception
private static java.lang.IllegalArgumentException notEnoughDataException(ByteBuf in)
static int decodeULE128(ByteBuf in, int result) throws Http2Exception
Visible for testing only!
Http2Exception
static long decodeULE128(ByteBuf in, long result) throws Http2Exception
Visible for testing only!
Http2Exception