Home / Function/ testTotalHeaderLimit() — netty Function Reference

testTotalHeaderLimit() — netty Function Reference

Architecture documentation for the testTotalHeaderLimit() function in HttpResponseDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  826ab2e2_7f78_7506_1345_a9c793d12d3f["testTotalHeaderLimit()"]
  90546a8c_51c4_a9dc_b6e8_695d29269596["HttpResponseDecoderTest"]
  826ab2e2_7f78_7506_1345_a9c793d12d3f -->|defined in| 90546a8c_51c4_a9dc_b6e8_695d29269596
  style 826ab2e2_7f78_7506_1345_a9c793d12d3f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java lines 109–135

    @Test
    void testTotalHeaderLimit() throws Exception {
        String requestStr = "HTTP/1.1 200 OK\r\n" +
                "Server: X\r\n" + // 9 content bytes
                "a1: b\r\n" +     // + 5 = 14 bytes,
                "a2: b\r\n\r\n";  // + 5 = 19 bytes

        // Decoding with a max header size of 18 bytes must fail:
        EmbeddedChannel channel = new EmbeddedChannel(new HttpResponseDecoder(1024, 18, 1024));
        assertTrue(channel.writeInbound(Unpooled.copiedBuffer(requestStr, CharsetUtil.US_ASCII)));
        HttpResponse response = channel.readInbound();
        assertTrue(response.decoderResult().isFailure());
        assertInstanceOf(TooLongHttpHeaderException.class, response.decoderResult().cause());
        assertFalse(channel.finish());

        // Decoding with a max header size of 19 must pass:
        channel = new EmbeddedChannel(new HttpResponseDecoder(1024, 19, 1024));
        assertTrue(channel.writeInbound(Unpooled.copiedBuffer(requestStr, CharsetUtil.US_ASCII)));
        response = channel.readInbound();
        assertTrue(response.decoderResult().isSuccess());
        assertEquals("X", response.headers().get("Server"));
        assertEquals("b", response.headers().get("a1"));
        assertEquals("b", response.headers().get("a2"));
        channel.close();
        assertEquals(LastHttpContent.EMPTY_LAST_CONTENT, channel.readInbound());
        assertFalse(channel.finish());
    }

Domain

Subdomains

Frequently Asked Questions

What does testTotalHeaderLimit() do?
testTotalHeaderLimit() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java.
Where is testTotalHeaderLimit() defined?
testTotalHeaderLimit() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java at line 109.

Analyze Your Own Codebase

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

Try Supermodel Free