Implementation Note
This class is security sensitive, and depends on users correctly identifying their headers as security sensitive or not. If a header is considered not sensitive, methods names "insensitive" are used which are fast, but don't provide any security guarantees.
| Modifier and Type | Class and Description |
|---|---|
| private static class | HpackEncoder.HeaderEntry
A linked hash map HpackHeaderField entry. |
| Modifier and Type | Field and Description |
|---|---|
| private final byte | |
| private final HpackEncoder. | |
| private final HpackEncoder. | |
| private final HpackHuffmanEncoder | |
| pack-priv static final int | |
| private final int | |
| private final boolean | |
| private long | |
| private long | |
| pack-priv static final int | |
| private long |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | |
| pack-priv | HpackEncoder(boolean ignoreMaxHeaderListSize, int arraySizeHint, int huffCodeThreshold)
Creates a new encoder. |
| Modifier and Type | Method and Description |
|---|---|
| private void | add(CharSequence name, CharSequence value, long headerSize)
Add the header field to the dynamic table. |
| private void | |
| private void | encodeHeader(Buffer out, CharSequence name, CharSequence value, boolean sensitive, long headerSize)
Encode the header field into the header block. |
| public void | encodeHeaders(int streamId, Buffer out, Http2Headers headers, Http2HeadersEncoder.
Encode the header field into the header block. |
| private void | encodeHeadersEnforceMaxHeaderListSize(int streamId, Buffer out, Http2Headers headers, Http2HeadersEncoder.
|
| private void | encodeHeadersIgnoreMaxHeaderListSize(Buffer out, Http2Headers headers, Http2HeadersEncoder.
|
| private static void | |
| private static void | |
| private void | encodeLiteral(Buffer out, CharSequence name, CharSequence value, HpackUtil.
Encode literal header field according to Section 6.2. |
| private void | |
| private void | ensureCapacity(long headerSize)
Ensure that the dynamic table has enough room to hold 'headerSize' more bytes. |
| private HpackEncoder. | getEntryInsensitive(CharSequence name, CharSequence value)
Returns the header entry with the lowest index value for the header field. |
| pack-priv HpackHeaderField | |
| private int | getIndex(CharSequence name)
Returns the lowest index value for the header field name in the dynamic table. |
| private int | |
| public long | |
| public long | |
| private int | |
| private int | |
| pack-priv int | |
| private HpackHeaderField | |
| public void | |
| public void | |
| pack-priv long |
| hashMask | back to summary |
|---|---|
| private final byte hashMask | |
| head | back to summary |
|---|---|
| private final HpackEncoder. | |
| headerFields | back to summary |
|---|---|
| private final HpackEncoder. | |
| hpackHuffmanEncoder | back to summary |
|---|---|
| private final HpackHuffmanEncoder hpackHuffmanEncoder | |
| HUFF_CODE_THRESHOLD | back to summary |
|---|---|
| pack-priv static final int HUFF_CODE_THRESHOLD | |
| huffCodeThreshold | back to summary |
|---|---|
| private final int huffCodeThreshold | |
| ignoreMaxHeaderListSize | back to summary |
|---|---|
| private final boolean ignoreMaxHeaderListSize | |
| maxHeaderListSize | back to summary |
|---|---|
| private long maxHeaderListSize | |
| maxHeaderTableSize | back to summary |
|---|---|
| private long maxHeaderTableSize | |
| NOT_FOUND | back to summary |
|---|---|
| pack-priv static final int NOT_FOUND | |
| size | back to summary |
|---|---|
| private long size | |
| HpackEncoder | back to summary |
|---|---|
| pack-priv HpackEncoder() Creates a new encoder. | |
| HpackEncoder | back to summary |
|---|---|
| pack-priv HpackEncoder(boolean ignoreMaxHeaderListSize) Creates a new encoder. | |
| HpackEncoder | back to summary |
|---|---|
| pack-priv HpackEncoder(boolean ignoreMaxHeaderListSize, int arraySizeHint, int huffCodeThreshold) Creates a new encoder. | |
| add | back to summary |
|---|---|
| private void add(CharSequence name, CharSequence value, long headerSize) Add the header field to the dynamic table. Entries are evicted from the dynamic table until the size of the table and the new header field is less than the table's maxHeaderTableSize. If the size of the new entry is larger than the table's maxHeaderTableSize, the dynamic table will be cleared. | |
| clear | back to summary |
|---|---|
| private void clear() Remove all entries from the dynamic table. | |
| encodeHeader | back to summary |
|---|---|
| private void encodeHeader(Buffer out, CharSequence name, CharSequence value, boolean sensitive, long headerSize) Encode the header field into the header block.
The given | |
| encodeHeaders | back to summary |
|---|---|
| public void encodeHeaders(int streamId, Buffer out, Http2Headers headers, Http2HeadersEncoder. Encode the header field into the header block.
The given | |
| encodeHeadersEnforceMaxHeaderListSize | back to summary |
|---|---|
| private void encodeHeadersEnforceMaxHeaderListSize(int streamId, Buffer out, Http2Headers headers, Http2HeadersEncoder. | |
| encodeHeadersIgnoreMaxHeaderListSize | back to summary |
|---|---|
| private void encodeHeadersIgnoreMaxHeaderListSize(Buffer out, Http2Headers headers, Http2HeadersEncoder. | |
| encodeInteger | back to summary |
|---|---|
| private static void encodeInteger(Buffer out, int mask, int n, int i) Encode integer according to Section 5.1. | |
| encodeInteger | back to summary |
|---|---|
| private static void encodeInteger(Buffer out, int mask, int n, long i) Encode integer according to Section 5.1. | |
| encodeLiteral | back to summary |
|---|---|
| private void encodeLiteral(Buffer out, CharSequence name, CharSequence value, HpackUtil. Encode literal header field according to Section 6.2. | |
| encodeStringLiteral | back to summary |
|---|---|
| private void encodeStringLiteral(Buffer out, CharSequence string) Encode string literal according to Section 5.2. | |
| ensureCapacity | back to summary |
|---|---|
| private void ensureCapacity(long headerSize) Ensure that the dynamic table has enough room to hold 'headerSize' more bytes. Removes the oldest entry from the dynamic table until sufficient space is available. | |
| getEntryInsensitive | back to summary |
|---|---|
| private HpackEncoder. Returns the header entry with the lowest index value for the header field. Returns null if header field is not in the dynamic table. | |
| getHeaderField | back to summary |
|---|---|
| pack-priv HpackHeaderField getHeaderField(int index) Return the header field at the given index. Exposed for testing. | |
| getIndex | back to summary |
|---|---|
| private int getIndex(CharSequence name) Returns the lowest index value for the header field name in the dynamic table. Returns -1 if the header field name is not in the dynamic table. | |
| getIndex | back to summary |
|---|---|
| private int getIndex(int index) Compute the index into the dynamic table given the index in the header entry. | |
| getMaxHeaderListSize | back to summary |
|---|---|
| public long getMaxHeaderListSize() | |
| getMaxHeaderTableSize | back to summary |
|---|---|
| public long getMaxHeaderTableSize() Return the maximum table size. | |
| getNameIndex | back to summary |
|---|---|
| private int getNameIndex(CharSequence name) | |
| index | back to summary |
|---|---|
| private int index(int h) Returns the index into the hash table for the hash code h. | |
| length | back to summary |
|---|---|
| pack-priv int length() Return the number of header fields in the dynamic table. Exposed for testing. | |
| remove | back to summary |
|---|---|
| private HpackHeaderField remove() Remove and return the oldest header field from the dynamic table. | |
| setMaxHeaderListSize | back to summary |
|---|---|
| public void setMaxHeaderListSize(long maxHeaderListSize) throws Http2Exception | |
| setMaxHeaderTableSize | back to summary |
|---|---|
| public void setMaxHeaderTableSize(Buffer out, long maxHeaderTableSize) throws Http2Exception Set the maximum table size. | |
| size | back to summary |
|---|---|
| pack-priv long size() Return the size of the dynamic table. Exposed for testing. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv HpackEncoder. | |
| pack-priv HpackEncoder. | |
| pack-priv int | |
| pack-priv int | |
| pack-priv HpackEncoder. |
| Access | Constructor and Description |
|---|---|
| pack-priv | HeaderEntry(int hash, CharSequence name, CharSequence value, int index, HpackEncoder.
Creates new entry. |
| Modifier and Type | Method and Description |
|---|---|
| private void | addBefore(HpackEncoder.
Inserts this entry before the specified existing entry in the list. |
| private void |
| after | back to summary |
|---|---|
| pack-priv HpackEncoder. | |
| before | back to summary |
|---|---|
| pack-priv HpackEncoder. | |
| hash | back to summary |
|---|---|
| pack-priv int hash | |
| index | back to summary |
|---|---|
| pack-priv int index | |
| next | back to summary |
|---|---|
| pack-priv HpackEncoder. | |
| HeaderEntry | back to summary |
|---|---|
| pack-priv HeaderEntry(int hash, CharSequence name, CharSequence value, int index, HpackEncoder. Creates new entry. | |
| addBefore | back to summary |
|---|---|
| private void addBefore(HpackEncoder. Inserts this entry before the specified existing entry in the list. | |
| remove | back to summary |
|---|---|
| private void remove() Removes this entry from the linked list. | |