Home / Function/ splitHeader() — netty Function Reference

splitHeader() — netty Function Reference

Architecture documentation for the splitHeader() function in HttpObjectDecoder.java from the netty codebase.

Function java ProtocolCodecs HTTP calls 4 called by 2

Entity Profile

Dependency Diagram

graph TD
  40673f8f_e843_c287_a057_291f8aa2ac4d["splitHeader()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae["HttpObjectDecoder"]
  40673f8f_e843_c287_a057_291f8aa2ac4d -->|defined in| 6c551372_1bb2_fe27_3884_c4cc297c86ae
  91c85325_7220_8d93_a39b_91415ca496f4["State()"]
  91c85325_7220_8d93_a39b_91415ca496f4 -->|calls| 40673f8f_e843_c287_a057_291f8aa2ac4d
  ae0e6d22_7857_48d7_2163_e474a9e3073b["LastHttpContent()"]
  ae0e6d22_7857_48d7_2163_e474a9e3073b -->|calls| 40673f8f_e843_c287_a057_291f8aa2ac4d
  e8aadc10_5550_f709_7873_e84704f04e88["isDecodingRequest()"]
  40673f8f_e843_c287_a057_291f8aa2ac4d -->|calls| e8aadc10_5550_f709_7873_e84704f04e88
  2b5a1e5d_3274_82c2_5ac9_47f058c1a2d6["isOWS()"]
  40673f8f_e843_c287_a057_291f8aa2ac4d -->|calls| 2b5a1e5d_3274_82c2_5ac9_47f058c1a2d6
  e0010314_3a91_8cf4_d472_336bc8dd9e0e["findNonWhitespace()"]
  40673f8f_e843_c287_a057_291f8aa2ac4d -->|calls| e0010314_3a91_8cf4_d472_336bc8dd9e0e
  06fd4062_6fee_1709_b2d3_89c0192da3ba["findEndOfString()"]
  40673f8f_e843_c287_a057_291f8aa2ac4d -->|calls| 06fd4062_6fee_1709_b2d3_89c0192da3ba
  style 40673f8f_e843_c287_a057_291f8aa2ac4d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java lines 1028–1075

    private void splitHeader(byte[] line, int start, int length) {
        final int end = start + length;
        int nameEnd;
        final int nameStart = start;
        // hoist this load out of the loop, because it won't change!
        final boolean isDecodingRequest = isDecodingRequest();
        for (nameEnd = nameStart; nameEnd < end; nameEnd ++) {
            byte ch = line[nameEnd];
            // https://tools.ietf.org/html/rfc7230#section-3.2.4
            //
            // No whitespace is allowed between the header field-name and colon. In
            // the past, differences in the handling of such whitespace have led to
            // security vulnerabilities in request routing and response handling. A
            // server MUST reject any received request message that contains
            // whitespace between a header field-name and colon with a response code
            // of 400 (Bad Request). A proxy MUST remove any such whitespace from a
            // response message before forwarding the message downstream.
            if (ch == ':' ||
                    // In case of decoding a request we will just continue processing and header validation
                    // is done in the DefaultHttpHeaders implementation.
                    //
                    // In the case of decoding a response we will "skip" the whitespace.
                    (!isDecodingRequest && isOWS(ch))) {
                break;
            }
        }

        if (nameEnd == end) {
            // There was no colon present at all.
            throw new IllegalArgumentException("No colon found");
        }
        int colonEnd;
        for (colonEnd = nameEnd; colonEnd < end; colonEnd ++) {
            if (line[colonEnd] == ':') {
                colonEnd ++;
                break;
            }
        }
        name = splitHeaderName(line, nameStart, nameEnd - nameStart);
        final int valueStart = findNonWhitespace(line, colonEnd, end);
        if (valueStart == end) {
            value = StringUtil.EMPTY_STRING;
        } else {
            final int valueEnd = findEndOfString(line, start, end);
            // no need to make uses of the ByteBuf's toString ASCII method here, and risk to get JIT confused
            value = langAsciiString(line, valueStart, valueEnd - valueStart);
        }
    }

Subdomains

Frequently Asked Questions

What does splitHeader() do?
splitHeader() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java.
Where is splitHeader() defined?
splitHeader() is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java at line 1028.
What does splitHeader() call?
splitHeader() calls 4 function(s): findEndOfString, findNonWhitespace, isDecodingRequest, isOWS.
What calls splitHeader()?
splitHeader() is called by 2 function(s): LastHttpContent, State.

Analyze Your Own Codebase

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

Try Supermodel Free