← All compilation units

Flyology.HTTP.Server.HTTP_3

Description

Serves one HTTP/3 connection through the high-level application exchange API. The caller supplies an exclusively owned, bound UDP socket. Serve receives the first client Initial, connects the socket to that peer, and owns QUIC and HTTP/3 protocol state until the connection ends.

App_Context

type App_Context is limited private;

Default_Connection_Capacity

Default_Connection_Capacity : constant Positive := 128;

Default listener capacity for the task-per-connection profile.

Default_Handshake_Idle_Timeout

Default_Handshake_Idle_Timeout : constant Duration := 3.0;

Default no-progress deadline for a connection that has not completed its QUIC handshake. A peer that abandons a handshake without sending CONNECTION_CLOSE would otherwise hold its listener slot for the whole handshake timeout. Handshake retransmission arrives well inside this window on a lossy path, so only a silent peer reaches it.

Default_Requests_Per_Connection

Default_Requests_Per_Connection : constant Positive := 100_000;

Default lifetime request policy. Completed request reassembly is recycled; 32 retained QUIC streams bound concurrency, while compact flow-control accounting supports long-lived connections without retaining completed request state.

Handle

procedure Handle
(Context : in out App_Context;
X       : in out Flyology.HTTP.Server.Applications.Exchange)
Parameters
Context
X

Handler_Model

Handler_Model : Flyology.Execution_Model := Flyology.Project_Default;

Maximum_Connection_Capacity

Maximum_Connection_Capacity : constant Positive := 256;

Largest accepted listener capacity for the task-per-connection profile.

Maximum_Requests_Per_Connection

Maximum_Requests_Per_Connection : constant Positive := 1_000_000;

Largest accepted lifetime request policy for the bounded profile.

Serve

procedure Serve
  (Context            : in out App_Context;
   Socket             : aliased in out Flyology.IO.Sockets.Socket_Type;
   Certificate_DER    : Ada.Streams.Stream_Element_Array;
   Private_Key        : Flyology.QUIC.Connections.Ed25519_Private_Key;
   Source             : Flyology.QUIC.Connections.Connection_ID;
   Transport_Settings : Flyology.QUIC.Connections.Transport_Settings :=
     (others => <>);
   Timeout            : Duration := 30.0;
   Handshake_Timeout  : Duration := 10.0;
   Max_Connection_Age : Duration := 300.0;
   Max_Requests       : Positive := Default_Requests_Per_Connection;
   Token              : access Flyology.Cancellation.Token := null;
   Handshake_Idle_Timeout : Duration := Default_Handshake_Idle_Timeout)

Serve routed requests from one QUIC peer. Certificate_DER and Private_Key form the Ed25519 server identity used by the Ada-native QUIC handshake. Source must be a fresh server connection identifier. Operations retain ordinary synchronous Ada semantics in native and lightweight task lanes.

Parameters
Context

Shared application context

Socket

Exclusively owned bound UDP socket

Certificate_DER

DER-encoded Ed25519 server certificate

Private_Key

Raw Ed25519 private key for Certificate_DER

Source

Fresh server source connection identifier

Transport_Settings

QUIC flow-control and stream limits

Timeout

Per-request application deadline

Handshake_Timeout

Maximum time to establish QUIC

Max_Connection_Age

Absolute connection lifetime; negative is unlimited

Max_Requests

Requests served before Serve returns

Token

Optional connection cancellation source

Handshake_Idle_Timeout

Maximum time an unconnected peer may go silent before Serve returns

Serve

procedure Serve
  (Context            : in out App_Context;
   Socket             : aliased in out Flyology.IO.Sockets.Socket_Type;
   Certificate_DER    : Ada.Streams.Stream_Element_Array;
   Private_Key        : Flyology.QUIC.Connections.Ed25519_Private_Key;
   Transport_Settings : Flyology.QUIC.Connections.Transport_Settings :=
     (others => <>);
   Timeout            : Duration := 30.0;
   Handshake_Timeout  : Duration := 10.0;
   Max_Connection_Age : Duration := 300.0;
   Max_Requests       : Positive := Default_Requests_Per_Connection;
   Token              : access Flyology.Cancellation.Token := null;
   Handshake_Idle_Timeout : Duration := Default_Handshake_Idle_Timeout)

Serve routed requests from one QUIC peer using a securely generated server connection identifier. This is the ordinary application entry point; use the Source overload when identifier ownership belongs to an external connection manager.

Parameters
Context

Shared application context

Socket

Exclusively owned bound UDP socket

Certificate_DER

DER-encoded Ed25519 server certificate

Private_Key

Raw Ed25519 private key for Certificate_DER

Transport_Settings

QUIC flow-control and stream limits

Timeout

Per-request application deadline

Handshake_Timeout

Maximum time to establish QUIC

Max_Connection_Age

Absolute connection lifetime; negative is unlimited

Max_Requests

Requests served before Serve returns

Token

Optional connection cancellation source

Handshake_Idle_Timeout

Maximum time an unconnected peer may go silent before Serve returns

Serve_Listener

procedure Serve_Listener
  (Context            : aliased in out App_Context;
   Socket             : aliased in out Flyology.IO.Sockets.Socket_Type;
   Certificate_DER    : Ada.Streams.Stream_Element_Array;
   Private_Key        : Flyology.QUIC.Connections.Ed25519_Private_Key;
   Capacity           : Positive := Default_Connection_Capacity;
   Transport_Settings : Flyology.QUIC.Connections.Transport_Settings :=
     (others => <>);
   Timeout            : Duration := 30.0;
   Handshake_Timeout  : Duration := 10.0;
   Max_Connection_Age : Duration := 300.0;
   Max_Requests       : Positive := Default_Requests_Per_Connection;
   Token              : not null access Flyology.Cancellation.Token;
   Handshake_Idle_Timeout : Duration := Default_Handshake_Idle_Timeout)

Run a bounded multi-connection HTTP/3 listener on an unconnected bound UDP socket. One receiver dispatches datagrams by connection identifier to Capacity fixed worker tasks. The caller requests shutdown through Token; Serve_Listener then drains its workers and returns without closing Socket.

Parameters
Context

Shared application context; mutable parts synchronize

Socket

Exclusively owned bound UDP listener

Certificate_DER

DER-encoded Ed25519 server certificate

Private_Key

Raw Ed25519 private key for Certificate_DER

Capacity

Maximum concurrent QUIC connections

Transport_Settings

QUIC flow-control and stream limits

Timeout

Per-request application deadline

Handshake_Timeout

Maximum time to establish each QUIC connection

Max_Connection_Age

Absolute lifetime of each connection

Max_Requests

Requests served by each connection

Token

Required listener shutdown and connection cancellation

Handshake_Idle_Timeout

Maximum time an unconnected peer may go silent before its connection slot is reclaimed