Home / Function/ finish() — netty Function Reference

finish() — netty Function Reference

Architecture documentation for the finish() function in Http3HeadersSink.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  73e61a10_dc7f_b1aa_9db6_8a00480711c6["finish()"]
  7f15a7d9_1c9f_da48_4b29_ed705f5855b4["Http3HeadersSink"]
  73e61a10_dc7f_b1aa_9db6_8a00480711c6 -->|defined in| 7f15a7d9_1c9f_da48_4b29_ed705f5855b4
  549ec78d_c464_7480_1160_dd309c3e68b7["authorityOrHostHeaderReceived()"]
  73e61a10_dc7f_b1aa_9db6_8a00480711c6 -->|calls| 549ec78d_c464_7480_1160_dd309c3e68b7
  style 73e61a10_dc7f_b1aa_9db6_8a00480711c6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/Http3HeadersSink.java lines 58–138

    void finish() throws Http3HeadersValidationException, Http3Exception {
        if (exceededMaxLength) {
            throw new Http3Exception(Http3ErrorCode.H3_EXCESSIVE_LOAD,
                    String.format("Header size exceeded max allowed size (%d)", maxHeaderListSize));
        }
        if (validationException != null) {
            throw validationException;
        }
        if (validate) {
            if (trailer) {
                if (receivedPseudoHeaders != 0) {
                    // Trailers must not have pseudo headers.
                    throw new Http3HeadersValidationException("Pseudo-header(s) included in trailers.");
                }
                return;
            }

            // Validate that all mandatory pseudo-headers are included.
            if (request) {
                CharSequence method = headers.method();
                // fast-path
                if (HttpMethod.CONNECT.asciiName().contentEqualsIgnoreCase(method)) {
                    // Check if this is an Extended CONNECT request (RFC 9220)
                    // Extended CONNECT includes the :protocol pseudo-header
                    if ((receivedPseudoHeaders & PROTOCOL.getFlag()) != 0) {
                        // Extended CONNECT (RFC 9220) requires:
                        // - :method
                        // - :scheme
                        // - :authority
                        // - :path
                        // - :protocol
                        final int requiredPseudoHeaders = METHOD.getFlag() | SCHEME.getFlag() |
                                                         AUTHORITY.getFlag() | PATH.getFlag() | PROTOCOL.getFlag();
                        if (receivedPseudoHeaders != requiredPseudoHeaders) {
                            throw new Http3HeadersValidationException(
                                    "Not all mandatory pseudo-headers included for Extended CONNECT.");
                        }
                    } else {
                        // Regular CONNECT (RFC 9114) requires:
                        // - :method
                        // - :authority
                        final int requiredPseudoHeaders = METHOD.getFlag() | AUTHORITY.getFlag();
                        if (receivedPseudoHeaders != requiredPseudoHeaders) {
                            throw new Http3HeadersValidationException("Not all mandatory pseudo-headers included.");
                        }
                    }
                } else if (HttpMethod.OPTIONS.asciiName().contentEqualsIgnoreCase(method)) {
                    // See:
                    //
                    // https://www.rfc-editor.org/rfc/rfc9114.html#section-4.3.1
                    // https://www.rfc-editor.org/rfc/rfc9110#section-7.1
                    // - :method
                    // - :scheme
                    // - :authority
                    // - :path
                    final int requiredPseudoHeaders = METHOD.getFlag() | SCHEME.getFlag() | PATH.getFlag();
                    if ((receivedPseudoHeaders & requiredPseudoHeaders) != requiredPseudoHeaders ||
                            (!authorityOrHostHeaderReceived() && !"*".contentEquals(headers.path()))) {
                        throw new Http3HeadersValidationException("Not all mandatory pseudo-headers included.");
                    }
                } else {
                    // For other requests we must include:
                    // - :method
                    // - :scheme
                    // - :authority
                    // - :path
                    final int requiredPseudoHeaders = METHOD.getFlag() | SCHEME.getFlag() | PATH.getFlag();
                    if ((receivedPseudoHeaders & requiredPseudoHeaders) != requiredPseudoHeaders ||
                        !authorityOrHostHeaderReceived()) {
                        throw new Http3HeadersValidationException("Not all mandatory pseudo-headers included.");
                    }
                }
            } else {
                // For responses we must include:
                // - :status
                if (receivedPseudoHeaders != STATUS.getFlag()) {
                    throw new Http3HeadersValidationException("Not all mandatory pseudo-headers included.");
                }
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does finish() do?
finish() is a function in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3HeadersSink.java.
Where is finish() defined?
finish() is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3HeadersSink.java at line 58.
What does finish() call?
finish() calls 1 function(s): authorityOrHostHeaderReceived.

Analyze Your Own Codebase

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

Try Supermodel Free