Home / Function/ writeLargeHeaderWithPadding() — netty Function Reference

writeLargeHeaderWithPadding() — netty Function Reference

Architecture documentation for the writeLargeHeaderWithPadding() function in DefaultHttp2FrameWriterTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  38957c71_a60b_15d3_1d18_b92c73bc185f["writeLargeHeaderWithPadding()"]
  602c48d7_d78b_d8f3_745e_26d2ab6ce0f2["DefaultHttp2FrameWriterTest"]
  38957c71_a60b_15d3_1d18_b92c73bc185f -->|defined in| 602c48d7_d78b_d8f3_745e_26d2ab6ce0f2
  18257f7e_6b98_6a1c_3968_7d340060c175["writeHeaders()"]
  38957c71_a60b_15d3_1d18_b92c73bc185f -->|calls| 18257f7e_6b98_6a1c_3968_7d340060c175
  c45c4ed8_095d_7c7f_daa2_bd7f55ed4881["buildLargeHeaderPayload()"]
  38957c71_a60b_15d3_1d18_b92c73bc185f -->|calls| c45c4ed8_095d_7c7f_daa2_bd7f55ed4881
  style 38957c71_a60b_15d3_1d18_b92c73bc185f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2FrameWriterTest.java lines 255–295

    @Test
    public void writeLargeHeaderWithPadding() throws Exception {
        int streamId = 1;
        Http2Headers headers = new DefaultHttp2Headers()
                .method("GET").path("/").authority("foo.com").scheme("https");
        headers = dummyHeaders(headers, 20);

        http2HeadersEncoder.configuration().maxHeaderListSize(Integer.MAX_VALUE);
        frameWriter.headersConfiguration().maxHeaderListSize(Integer.MAX_VALUE);
        frameWriter.maxFrameSize(Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND);
        frameWriter.writeHeaders(ctx, streamId, headers, 5, true, promise);

        byte[] expectedPayload = buildLargeHeaderPayload(streamId, headers, (byte) 4,
                Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND);

        // First frame: HEADER(length=0x4000, flags=0x09)
        assertEquals(Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND,
                outbound.readUnsignedMedium());
        assertEquals(0x01, outbound.readByte());
        assertEquals(0x09, outbound.readByte()); // 0x01 + 0x08
        assertEquals(streamId, outbound.readInt());

        byte[] firstPayload = new byte[Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND];
        outbound.readBytes(firstPayload);

        int remainPayloadLength = expectedPayload.length - Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND;
        // Second frame: CONTINUATION(length=remainPayloadLength, flags=0x04)
        assertEquals(remainPayloadLength, outbound.readUnsignedMedium());
        assertEquals(0x09, outbound.readByte());
        assertEquals(0x04, outbound.readByte());
        assertEquals(streamId, outbound.readInt());

        byte[] secondPayload = new byte[remainPayloadLength];
        outbound.readBytes(secondPayload);

        assertArrayEquals(Arrays.copyOfRange(expectedPayload, 0, firstPayload.length),
                firstPayload);
        assertArrayEquals(Arrays.copyOfRange(expectedPayload, firstPayload.length,
                expectedPayload.length),
                secondPayload);
    }

Domain

Subdomains

Frequently Asked Questions

What does writeLargeHeaderWithPadding() do?
writeLargeHeaderWithPadding() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2FrameWriterTest.java.
Where is writeLargeHeaderWithPadding() defined?
writeLargeHeaderWithPadding() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2FrameWriterTest.java at line 255.
What does writeLargeHeaderWithPadding() call?
writeLargeHeaderWithPadding() calls 2 function(s): buildLargeHeaderPayload, writeHeaders.

Analyze Your Own Codebase

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

Try Supermodel Free