Home / Class/ Http2CodecUtil Class — netty Architecture

Http2CodecUtil Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff["Http2CodecUtil"]
  0a43bf95_f934_af94_70a3_0ca258434af9["Http2CodecUtil.java"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|defined in| 0a43bf95_f934_af94_70a3_0ca258434af9
  1df40a39_f54c_b3bd_5485_4ff69cf6c839["calculateMaxHeaderListSizeGoAway()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| 1df40a39_f54c_b3bd_5485_4ff69cf6c839
  3cc81e37_6b15_4f65_8873_a608a7b23195["isOutboundStream()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| 3cc81e37_6b15_4f65_8873_a608a7b23195
  777ae115_be88_f0ed_3490_fdef75a68b98["isStreamIdValid()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| 777ae115_be88_f0ed_3490_fdef75a68b98
  ad64a7b0_3808_5363_9187_0d6836102955["isMaxFrameSizeValid()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| ad64a7b0_3808_5363_9187_0d6836102955
  3a6daac0_fca2_1b2b_47f3_cd80f30e3fec["ByteBuf()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| 3a6daac0_fca2_1b2b_47f3_cd80f30e3fec
  7d1c188e_033d_6c7a_6ce7_98fe908550a6["Http2Exception()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| 7d1c188e_033d_6c7a_6ce7_98fe908550a6
  d9d482a7_06b4_c753_1ffe_9cbe8d66ac33["readUnsignedInt()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| d9d482a7_06b4_c753_1ffe_9cbe8d66ac33
  8fc5fd67_b233_323f_0616_d5593ef8c76e["writeFrameHeader()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| 8fc5fd67_b233_323f_0616_d5593ef8c76e
  ff0356f4_eed0_0c00_fe44_16d301f196e3["streamableBytes()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| ff0356f4_eed0_0c00_fe44_16d301f196e3
  bb5ba404_b905_74aa_bee1_7c8afc02bcd5["headerListSizeExceeded()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| bb5ba404_b905_74aa_bee1_7c8afc02bcd5
  d1ddb7a9_5c19_a8d2_76ff_904e698e360a["writeFrameHeaderInternal()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| d1ddb7a9_5c19_a8d2_76ff_904e698e360a
  907847fb_2f10_33af_2766_23e22be7bb81["verifyPadding()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| 907847fb_2f10_33af_2766_23e22be7bb81
  959c71eb_0e46_4f2b_c081_ce168c36c08c["Http2CodecUtil()"]
  6edc25d4_1bef_4bc4_4c2d_9d321a931eff -->|method| 959c71eb_0e46_4f2b_c081_ce168c36c08c

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2CodecUtil.java lines 44–404

public final class Http2CodecUtil {
    public static final int CONNECTION_STREAM_ID = 0;
    public static final int HTTP_UPGRADE_STREAM_ID = 1;
    public static final CharSequence HTTP_UPGRADE_SETTINGS_HEADER = AsciiString.cached("HTTP2-Settings");
    public static final CharSequence HTTP_UPGRADE_PROTOCOL_NAME = "h2c";
    public static final CharSequence TLS_UPGRADE_PROTOCOL_NAME = ApplicationProtocolNames.HTTP_2;

    public static final int PING_FRAME_PAYLOAD_LENGTH = 8;
    public static final short MAX_UNSIGNED_BYTE = 0xff;
    /**
     * The maximum number of padding bytes. That is the 255 padding bytes appended to the end of a frame and the 1 byte
     * pad length field.
     */
    public static final int MAX_PADDING = 256;
    public static final long MAX_UNSIGNED_INT = 0xffffffffL;
    public static final int FRAME_HEADER_LENGTH = 9;
    public static final int SETTING_ENTRY_LENGTH = 6;
    public static final int PRIORITY_ENTRY_LENGTH = 5;
    public static final int INT_FIELD_LENGTH = 4;
    public static final short MAX_WEIGHT = 256;
    public static final short MIN_WEIGHT = 1;

    private static final ByteBuf CONNECTION_PREFACE = LeakPresenceDetector.staticInitializer(() ->
            unreleasableBuffer(directBuffer(24).writeBytes("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n".getBytes(UTF_8)))
                    .asReadOnly());

    private static final int MAX_PADDING_LENGTH_LENGTH = 1;
    public static final int DATA_FRAME_HEADER_LENGTH = FRAME_HEADER_LENGTH + MAX_PADDING_LENGTH_LENGTH;
    public static final int HEADERS_FRAME_HEADER_LENGTH =
            FRAME_HEADER_LENGTH + MAX_PADDING_LENGTH_LENGTH + INT_FIELD_LENGTH + 1;
    public static final int PRIORITY_FRAME_LENGTH = FRAME_HEADER_LENGTH + PRIORITY_ENTRY_LENGTH;
    public static final int RST_STREAM_FRAME_LENGTH = FRAME_HEADER_LENGTH + INT_FIELD_LENGTH;
    public static final int PUSH_PROMISE_FRAME_HEADER_LENGTH =
            FRAME_HEADER_LENGTH + MAX_PADDING_LENGTH_LENGTH + INT_FIELD_LENGTH;
    public static final int GO_AWAY_FRAME_HEADER_LENGTH = FRAME_HEADER_LENGTH + 2 * INT_FIELD_LENGTH;
    public static final int WINDOW_UPDATE_FRAME_LENGTH = FRAME_HEADER_LENGTH + INT_FIELD_LENGTH;
    public static final int CONTINUATION_FRAME_HEADER_LENGTH = FRAME_HEADER_LENGTH;

    public static final char SETTINGS_HEADER_TABLE_SIZE = 1;
    public static final char SETTINGS_ENABLE_PUSH = 2;
    public static final char SETTINGS_MAX_CONCURRENT_STREAMS = 3;
    public static final char SETTINGS_INITIAL_WINDOW_SIZE = 4;
    public static final char SETTINGS_MAX_FRAME_SIZE = 5;
    public static final char SETTINGS_MAX_HEADER_LIST_SIZE = 6;
    public static final char SETTINGS_ENABLE_CONNECT_PROTOCOL = 8;
    public static final int NUM_STANDARD_SETTINGS = 7;

    public static final long MAX_HEADER_TABLE_SIZE = MAX_UNSIGNED_INT;
    public static final long MAX_CONCURRENT_STREAMS = MAX_UNSIGNED_INT;
    public static final int MAX_INITIAL_WINDOW_SIZE = Integer.MAX_VALUE;
    public static final int MAX_FRAME_SIZE_LOWER_BOUND = 0x4000;
    public static final int MAX_FRAME_SIZE_UPPER_BOUND = 0xffffff;
    public static final long MAX_HEADER_LIST_SIZE = MAX_UNSIGNED_INT;

    public static final long MIN_HEADER_TABLE_SIZE = 0;
    public static final long MIN_CONCURRENT_STREAMS = 0;
    public static final int MIN_INITIAL_WINDOW_SIZE = 0;
    public static final long MIN_HEADER_LIST_SIZE = 0;

    public static final int DEFAULT_WINDOW_SIZE = 65535;
    public static final short DEFAULT_PRIORITY_WEIGHT = 16;
    public static final int DEFAULT_HEADER_TABLE_SIZE = 4096;
    /**
     * <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">The initial value of this setting is unlimited</a>.
     * However in practice we don't want to allow our peers to use unlimited memory by default. So we take advantage
     * of the <q>For any given request, a lower limit than what is advertised MAY be enforced.</q> loophole.
     */
    public static final long DEFAULT_HEADER_LIST_SIZE = 8192;
    public static final int DEFAULT_MAX_FRAME_SIZE = MAX_FRAME_SIZE_LOWER_BOUND;
    /**
     * The assumed minimum value for {@code SETTINGS_MAX_CONCURRENT_STREAMS} as
     * recommended by the <a herf="https://tools.ietf.org/html/rfc7540#section-6.5.2">HTTP/2 spec</a>.
     */
    public static final int SMALLEST_MAX_CONCURRENT_STREAMS = 100;
    static final int DEFAULT_MAX_RESERVED_STREAMS = SMALLEST_MAX_CONCURRENT_STREAMS;
    static final int DEFAULT_MIN_ALLOCATION_CHUNK = 1024;

    /**
     * Calculate the threshold in bytes which should trigger a {@code GO_AWAY} if a set of headers exceeds this amount.
     * @param maxHeaderListSize
     *      <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_MAX_HEADER_LIST_SIZE</a> for the local

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free