@Override
    public void process(final HttpRequest request, final EntityDetails entity, final HttpContext context)
            throws HttpException, IOException {

        Args.notNull(request, "HTTP request");
        Args.notNull(context, "HTTP context");

        // Check if the request method is TRACE
        if (Method.TRACE.isSame(request.getMethod())) {

            // A client MUST NOT send content in a TRACE request.
            if (entity != null) {
                throw new ProtocolException("TRACE request MUST NOT contain a request body.");
            }

            // Check for sensitive headers
            final Header authHeader = request.getHeader(HttpHeaders.AUTHORIZATION);
            if (authHeader != null) {
                throw new ProtocolException("TRACE request MUST NOT contain an Authorization header.");
            }

            // Check for cookies
            final Header cookieHeader = request.getHeader(HttpHeaders.COOKIE);
            if (cookieHeader != null) {
                throw new ProtocolException("TRACE request MUST NOT contain a Cookie header.");
            }
        }
    }
Processes an incoming HTTP request. If the request is of type TRACE, it performs the following actions:
<ul>
  <li>Throws a {@link ProtocolException} if the request contains an {@code Authorization} header to prevent sensitive data leakage.</li>
  <li>Throws a {@link ProtocolException} if the request contains a {@code Cookie} header to prevent sensitive data leakage.</li>
  <li>Throws a {@link ProtocolException} if the request contains a body.</li>
</ul>

@param request The incoming HTTP request. Cannot be {@code null}.
@param entity  Details of the request entity. Can be {@code null}.
@param context The HTTP context.
@throws HttpException If a protocol error occurs.
@throws IOException   If an I/O error occurs.
httpclient5/src/main/java/org/apache/hc/client5/http/protocol/RequestValidateTrace.java