Home / File/ DefaultHttp3Headers.java — netty Source File

DefaultHttp3Headers.java — netty Source File

Architecture documentation for DefaultHttp3Headers.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2020 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.handler.codec.http3;

import io.netty.handler.codec.CharSequenceValueConverter;
import io.netty.handler.codec.DefaultHeaders;
import io.netty.util.AsciiString;
import io.netty.util.ByteProcessor;
import org.jetbrains.annotations.Nullable;

import static io.netty.handler.codec.http3.Http3Headers.PseudoHeaderName.hasPseudoHeaderFormat;
import static io.netty.util.AsciiString.CASE_INSENSITIVE_HASHER;
import static io.netty.util.AsciiString.CASE_SENSITIVE_HASHER;
import static io.netty.util.AsciiString.isUpperCase;

public final class DefaultHttp3Headers
        extends DefaultHeaders<CharSequence, CharSequence, Http3Headers> implements Http3Headers {
    private static final ByteProcessor HTTP3_NAME_VALIDATOR_PROCESSOR = new ByteProcessor() {
        @Override
        public boolean process(byte value) {
            return !isUpperCase(value);
        }
    };
    static final NameValidator<CharSequence> HTTP3_NAME_VALIDATOR = new NameValidator<CharSequence>() {
        @Override
        public void validateName(@Nullable CharSequence name) {
            if (name == null || name.length() == 0) {
                throw new Http3HeadersValidationException(String.format("empty headers are not allowed [%s]", name));
            }
            if (name instanceof AsciiString) {
                final int index;
                try {
                    index = ((AsciiString) name).forEachByte(HTTP3_NAME_VALIDATOR_PROCESSOR);
                } catch (Http3HeadersValidationException e) {
                    throw e;
                } catch (Throwable t) {
                    throw new Http3HeadersValidationException(
                            String.format("unexpected error. invalid header name [%s]", name), t);
                }

                if (index != -1) {
                    throw new Http3HeadersValidationException(String.format("invalid header name [%s]", name));
                }
            } else {
                for (int i = 0; i < name.length(); ++i) {
                    if (isUpperCase(name.charAt(i))) {
                        throw new Http3HeadersValidationException(String.format("invalid header name [%s]", name));
// ... (167 more lines)

Domain

Subdomains

Frequently Asked Questions

What does DefaultHttp3Headers.java do?
DefaultHttp3Headers.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Allocators subdomain.
Where is DefaultHttp3Headers.java in the architecture?
DefaultHttp3Headers.java is located at codec-http3/src/main/java/io/netty/handler/codec/http3/DefaultHttp3Headers.java (domain: Buffer, subdomain: Allocators, directory: codec-http3/src/main/java/io/netty/handler/codec/http3).

Analyze Your Own Codebase

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

Try Supermodel Free