Home / Class/ DefaultHttp2HeadersDecoder Class — netty Architecture

DefaultHttp2HeadersDecoder Class — netty Architecture

Architecture documentation for the DefaultHttp2HeadersDecoder class in DefaultHttp2HeadersDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac["DefaultHttp2HeadersDecoder"]
  903b6185_ab8e_b856_3d68_44b45cdea8da["DefaultHttp2HeadersDecoder.java"]
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac -->|defined in| 903b6185_ab8e_b856_3d68_44b45cdea8da
  10d90cf8_8f10_1ef2_d182_3f067b4930f9["DefaultHttp2HeadersDecoder()"]
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac -->|method| 10d90cf8_8f10_1ef2_d182_3f067b4930f9
  70423742_5e72_b5e8_c2b0_9ffe6d43b648["maxHeaderTableSize()"]
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac -->|method| 70423742_5e72_b5e8_c2b0_9ffe6d43b648
  c6e970b7_99dd_2caa_906e_90dd55836655["maxHeaderListSize()"]
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac -->|method| c6e970b7_99dd_2caa_906e_90dd55836655
  80a49b5b_3c16_f7ac_c05f_cd5402b4ab84["maxHeaderListSizeGoAway()"]
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac -->|method| 80a49b5b_3c16_f7ac_c05f_cd5402b4ab84
  8e140930_80c9_33b0_552d_6db65b9eab9a["Configuration()"]
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac -->|method| 8e140930_80c9_33b0_552d_6db65b9eab9a
  6abf07b0_d448_83c3_0c1a_989d9677297a["Http2Headers()"]
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac -->|method| 6abf07b0_d448_83c3_0c1a_989d9677297a
  ebca73b9_5148_5d5e_4e9e_d9535ecf336e["numberOfHeadersGuess()"]
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac -->|method| ebca73b9_5148_5d5e_4e9e_d9535ecf336e
  c45a055a_aca9_384b_5caf_8feae39d1c9e["validateHeaders()"]
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac -->|method| c45a055a_aca9_384b_5caf_8feae39d1c9e
  b953b45c_b328_d747_f2d8_80cb1670f87c["validateHeaderValues()"]
  b3d1a32b_cb45_8f74_3a9b_931797e1d4ac -->|method| b953b45c_b328_d747_f2d8_80cb1670f87c

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2HeadersDecoder.java lines 26–211

public class DefaultHttp2HeadersDecoder implements Http2HeadersDecoder, Http2HeadersDecoder.Configuration {
    private static final float HEADERS_COUNT_WEIGHT_NEW = 1 / 5f;
    private static final float HEADERS_COUNT_WEIGHT_HISTORICAL = 1 - HEADERS_COUNT_WEIGHT_NEW;

    private final HpackDecoder hpackDecoder;
    private final boolean validateHeaders;
    private final boolean validateHeaderValues;
    private long maxHeaderListSizeGoAway;

    /**
     * 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 float headerArraySizeAccumulator = 8;

    public DefaultHttp2HeadersDecoder() {
        this(true);
    }

    /**
     * Create a new instance.
     * @param validateHeaders {@code true} to validate headers are valid according to the RFC.
     */
    public DefaultHttp2HeadersDecoder(boolean validateHeaders) {
        this(validateHeaders, DEFAULT_HEADER_LIST_SIZE);
    }

    /**
     * Create a new instance.
     *
     * @param validateHeaders {@code true} to validate headers are valid according to the RFC.
     * This validates everything except header values.
     * @param validateHeaderValues {@code true} to validate that header <em>values</em> are valid according to the RFC.
     * Since this is potentially expensive, it can be enabled separately from {@code validateHeaders}.
     */
    public DefaultHttp2HeadersDecoder(boolean validateHeaders, boolean validateHeaderValues) {
        this(validateHeaders, validateHeaderValues, DEFAULT_HEADER_LIST_SIZE);
    }

    /**
     * Create a new instance.
     * @param validateHeaders {@code true} to validate headers are valid according to the RFC.
     * @param maxHeaderListSize This is the only setting that can be configured before notifying the peer.
     *  This is because <a href="https://tools.ietf.org/html/rfc7540#section-6.5.1">SETTINGS_MAX_HEADER_LIST_SIZE</a>
     *  allows a lower than advertised limit from being enforced, and the default limit is unlimited
     *  (which is dangerous).
     */
    public DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize) {
        this(validateHeaders, false, new HpackDecoder(maxHeaderListSize));
    }

    /**
     * Create a new instance.
     * @param validateHeaders {@code true} to validate headers are valid according to the RFC.
     * This validates everything except header values.
     * @param validateHeaderValues {@code true} to validate that header <em>values</em> are valid according to the RFC.
     * Since this is potentially expensive, it can be enabled separately from {@code validateHeaders}.
     * @param maxHeaderListSize This is the only setting that can be configured before notifying the peer.
     *  This is because <a href="https://tools.ietf.org/html/rfc7540#section-6.5.1">SETTINGS_MAX_HEADER_LIST_SIZE</a>
     *  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) {
        this(validateHeaders, validateHeaderValues, new HpackDecoder(maxHeaderListSize));
    }

    /**
     * Create a new instance.
     * @param validateHeaders {@code true} to validate headers are valid according to the RFC.
     * This validates everything except header values.
     * @param maxHeaderListSize This is the only setting that can be configured before notifying the peer.
     *  This is because <a href="https://tools.ietf.org/html/rfc7540#section-6.5.1">SETTINGS_MAX_HEADER_LIST_SIZE</a>
     *  allows a lower than advertised limit from being enforced, and the default limit is unlimited
     *  (which is dangerous).
     * @param initialHuffmanDecodeCapacity Does nothing, do not use.
     */
    public DefaultHttp2HeadersDecoder(boolean validateHeaders, long maxHeaderListSize,
                                      @Deprecated int initialHuffmanDecodeCapacity) {
        this(validateHeaders, false, new HpackDecoder(maxHeaderListSize));
    }

Frequently Asked Questions

What is the DefaultHttp2HeadersDecoder class?
DefaultHttp2HeadersDecoder is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2HeadersDecoder.java.
Where is DefaultHttp2HeadersDecoder defined?
DefaultHttp2HeadersDecoder is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2HeadersDecoder.java at line 26.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free