← All compilation units

Flyology.HTTP.Server.Connection_Handlers

Description

Runs persistent HTTP requests through one application callback.

Handle

procedure Handle
(Item  : in out Flyology.HTTP.Server.Connection;
Value : Flyology.HTTP.Server.Request)

Process one parsed request. Handle may respond, start an SSE stream, or accept a WebSocket upgrade through Item.

Parameters
Item

HTTP connection for this request

Value

Parsed request

Serve

procedure Serve
  (Item               : in out Flyology.HTTP.Server.Connection;
   Timeout            : Duration := 30.0;
   Max_Body           : Natural := Max_Request_Body;
   Buffer_Body        : Boolean := True;
   Max_Requests       : Natural := 1_000;
   Max_Connection_Age : Duration := 300.0;
   Token              : access Flyology.Cancellation.Token := null)

Run requests until transport close or protocol upgrade. A callback that sends no response receives an automatic 204 response. Protocol errors receive a best-effort 400 response before that connection closes.

Parameters
Item

HTTP connection

Timeout

Monotonic deadline interval for each complete request

Max_Body

Application body limit, capped by Max_Request_Body

Buffer_Body

True for compatibility Content buffering; false exposes the body through Read_Body during Handle

Max_Requests

Maximum requests served before closing; zero is unlimited

Max_Connection_Age

Maximum connection lifetime in seconds; negative is unlimited

Token

Optional cancellation source