Home / Function/ testSanitization() — netty Function Reference

testSanitization() — netty Function Reference

Architecture documentation for the testSanitization() function in HpackEncoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  08c8f3da_5b00_c314_45af_0f086ae7ca49["testSanitization()"]
  a8203e54_7e3c_740d_20fe_825ed86c66af["HpackEncoderTest"]
  08c8f3da_5b00_c314_45af_0f086ae7ca49 -->|defined in| a8203e54_7e3c_740d_20fe_825ed86c66af
  b00b41c0_19cc_fa2e_f410_2d01e52c0fdd["verifyHeaderValueSanitization()"]
  08c8f3da_5b00_c314_45af_0f086ae7ca49 -->|calls| b00b41c0_19cc_fa2e_f410_2d01e52c0fdd
  style 08c8f3da_5b00_c314_45af_0f086ae7ca49 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/HpackEncoderTest.java lines 207–231

    @Test
    public void testSanitization() throws Http2Exception {
        final int headerValueSize = 300;
        StringBuilder actualHeaderValueBuilder = new StringBuilder();
        StringBuilder expectedHeaderValueBuilder = new StringBuilder();

        for (int i = 0; i < headerValueSize; i++) {
            actualHeaderValueBuilder.append((char) i); // Use the index as the code point value of the character.
            if (i <= 255) {
                expectedHeaderValueBuilder.append((char) i);
            } else {
                expectedHeaderValueBuilder.append('?'); // Expect this character to be sanitized.
            }
        }
        String actualHeaderValue = actualHeaderValueBuilder.toString();
        String expectedHeaderValue = expectedHeaderValueBuilder.toString();
        HpackEncoder encoderWithHuffmanEncoding =
                new HpackEncoder(false, 64, 0); // Low Huffman code threshold.
        HpackEncoder encoderWithoutHuffmanEncoding =
                new HpackEncoder(false, 64, Integer.MAX_VALUE); // High Huffman code threshold.

        // Expect the same decoded header value regardless of whether Huffman encoding is enabled or not.
        verifyHeaderValueSanitization(encoderWithHuffmanEncoding, actualHeaderValue, expectedHeaderValue);
        verifyHeaderValueSanitization(encoderWithoutHuffmanEncoding, actualHeaderValue, expectedHeaderValue);
    }

Domain

Subdomains

Frequently Asked Questions

What does testSanitization() do?
testSanitization() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/HpackEncoderTest.java.
Where is testSanitization() defined?
testSanitization() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/HpackEncoderTest.java at line 207.
What does testSanitization() call?
testSanitization() calls 1 function(s): verifyHeaderValueSanitization.

Analyze Your Own Codebase

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

Try Supermodel Free