HttpHeaderValidationUtil.java — netty Source File
Architecture documentation for HttpHeaderValidationUtil.java, a java file in the netty codebase.
Entity Profile
Relationship Graph
Source Code
/*
* Copyright 2022 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.http;
import io.netty.util.AsciiString;
import static io.netty.util.AsciiString.contentEqualsIgnoreCase;
/**
* Functions used to perform various validations of HTTP header names and values.
*/
public final class HttpHeaderValidationUtil {
private HttpHeaderValidationUtil() {
}
/**
* Check if a header name is "connection related".
* <p>
* The <a href="https://datatracker.ietf.org/doc/html/rfc9110#section-7.6.1">RFC9110</a> only specify an incomplete
* list of the following headers:
*
* <ul>
* <li><tt>Connection</tt></li>
* <li><tt>Proxy-Connection</tt></li>
* <li><tt>Keep-Alive</tt></li>
* <li><tt>TE</tt></li>
* <li><tt>Transfer-Encoding</tt></li>
* <li><tt>Upgrade</tt></li>
* </ul>
*
* @param name the name of the header to check. The check is case-insensitive.
* @param ignoreTeHeader {@code true} if the <tt>TE</tt> header should be ignored by this check.
* This is relevant for HTTP/2 header validation, where the <tt>TE</tt> header has special rules.
* @return {@code true} if the given header name is one of the specified connection-related headers.
*/
@SuppressWarnings("deprecation") // We need to check for deprecated headers as well.
public static boolean isConnectionHeader(CharSequence name, boolean ignoreTeHeader) {
// These are the known standard and non-standard connection related headers:
// - upgrade (7 chars)
// - connection (10 chars)
// - keep-alive (10 chars)
// - proxy-connection (16 chars)
// - transfer-encoding (17 chars)
//
// See https://datatracker.ietf.org/doc/html/rfc9113#section-8.2.2
// and https://datatracker.ietf.org/doc/html/rfc9110#section-7.6.1
// for the list of connection related headers.
// ... (122 more lines)
Domain
Subdomains
Classes
Source
Frequently Asked Questions
What does HttpHeaderValidationUtil.java do?
HttpHeaderValidationUtil.java is a source file in the netty codebase, written in java. It belongs to the ProtocolCodecs domain, HTTP subdomain.
Where is HttpHeaderValidationUtil.java in the architecture?
HttpHeaderValidationUtil.java is located at codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaderValidationUtil.java (domain: ProtocolCodecs, subdomain: HTTP, directory: codec-http/src/main/java/io/netty/handler/codec/http).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free