Skip to content

mod_http3/include/h3_hooks.h

Functions

Name
int h3_hook_fixups(request_rec * r)
const char * h3_hook_http_scheme(const request_rec * r)
apr_port_t h3_hook_default_port(const request_rec * r)
int h3_hook_ssl_conn_is_ssl(conn_rec * c)
int h3_hook_post_read_request(request_rec * r)
void h3_hook_pre_read_request(request_rec * r, conn_rec * c)
int h3_hook_access_checker(request_rec * r)
int h3_hook_http_create_request(request_rec * r)
int h3_status_handler(request_rec * r)

Functions Documentation

function h3_hook_fixups

int h3_hook_fixups(
    request_rec * r
)

Parameters:

  • r The request being fixed up.

Return: OK for an H3 request, DECLINED for a non-H3 request.

ap_hook_fixups. For H3 requests, runs the fixups chain and returns OK. For non-H3 requests, returns DECLINED so the standard fixups chain runs.

function h3_hook_http_scheme

const char * h3_hook_http_scheme(
    const request_rec * r
)

Parameters:

  • r The request.

Return: "https" for an H3 request, NULL to decline otherwise.

ap_hook_http_scheme. H3 connections are always TLS, but mod_ssl does not manage them and declines; without this hook self-referential URLs (redirects, REQUEST_SCHEME) would claim "http".

function h3_hook_default_port

apr_port_t h3_hook_default_port(
    const request_rec * r
)

Parameters:

  • r The request.

Return: 443 for an H3 request, 0 to decline otherwise.

ap_hook_default_port. Companion to the scheme hook: keeps the default port for H3 request URLs at 443 instead of 80.

function h3_hook_ssl_conn_is_ssl

int h3_hook_ssl_conn_is_ssl(
    conn_rec * c
)

Parameters:

  • c The connection.

Return: OK for an H3 connection, DECLINED otherwise.

ap_hook_ssl_conn_is_ssl. Marks H3 connections as TLS-protected for ap_ssl_conn_is_ssl() consumers (mod_rewrite %{HTTPS}, expression parser).

function h3_hook_post_read_request

int h3_hook_post_read_request(
    request_rec * r
)

Parameters:

  • r The request (unused).

Return: OK.

ap_hook_post_read_request. No-op for H3; reserved for future per-request initialisation. Always returns OK.

function h3_hook_pre_read_request

void h3_hook_pre_read_request(
    request_rec * r,
    conn_rec * c
)

Parameters:

  • r The request (unused).
  • c The connection (unused).

ap_hook_pre_read_request. No-op for H3 — the request is already fully parsed by nghttp3 before the dispatcher runs.

function h3_hook_access_checker

int h3_hook_access_checker(
    request_rec * r
)

Parameters:

  • r The request being checked.

Return: OK/413/400 for H3, DECLINED otherwise.

ap_hook_access_checker. DECLINED for HTTP/1.x, otherwise OK/413/400.

function h3_hook_http_create_request

int h3_hook_http_create_request(
    request_rec * r
)

Parameters:

  • r The newly created request.

Return: OK on install, DECLINED to skip.

ap_hook_http_create_request. Installs the H3 input and output filter chain (protocol + network) on a freshly created H3 request. Skips subrequests (r->main != NULL) and non-H3 requests.

function h3_status_handler

int h3_status_handler(
    request_rec * r
)

Parameters:

  • r The request being handled.

Return: OK when it serves "http3-status", DECLINED otherwise.

ap_hook_handler for the "http3-status" handler. Emits a JSON snapshot of this child's HTTP/3 metrics (live workers, connection/stream counts, and byte totals). Declines any other handler or a non-GET method.

Source code

/*
 * Copyright (c) 2026 The mod_http3 Project Authors. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed 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
 *
 *     http://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.
 */

#ifndef H3_HOOKS_H
#define H3_HOOKS_H

#include <httpd.h>

int h3_hook_fixups(request_rec* r);

const char* h3_hook_http_scheme(const request_rec* r);

apr_port_t h3_hook_default_port(const request_rec* r);

int h3_hook_ssl_conn_is_ssl(conn_rec* c);

int h3_hook_post_read_request(request_rec* r);

void h3_hook_pre_read_request(request_rec* r, conn_rec* c);

int h3_hook_access_checker(request_rec* r);

int h3_hook_http_create_request(request_rec* r);

int h3_status_handler(request_rec* r);

#endif /* H3_HOOKS_H */