Feature notes: HTTPS application layer notes (HTTP/1.1, h2, h3)
What tHttp3ServerConn needs from an authenticated QUIC connection. TsmHTTPSv3 supplies its own; implement it only to drive the engine from your own QUIC host. The engine calls it from inside its own methods. OpenStream opens a server unidirectional stream (ID mod 4 = 3) or returns False while the peer's stream limit blocks it; the engine retries on a later Pump. SendCapacity is how many bytes Send may take now on that stream; 0 pauses that stream until a later Pump (never block). Send must take the whole range together with the FIN flag and may keep aData, which neither side may modify. Consume gives the peer receive credit for aCount bytes the engine has finished with; credit for bytes of a reset stream that never reached Receive is yours to return. ResetSend, StopReceive and Close abort a stream's sending, ask the peer to stop sending, or close the connection, with an HTTP/3 error code.
function OpenStream(aUnidirectional: Boolean; out aStreamID: UInt64): Boolean;
function SendCapacity(aStreamID: UInt64): Integer;
procedure Send(aStreamID: UInt64; const aData: TBytes; aOffset, aCount: Integer; aFin: Boolean);
procedure Consume(aStreamID, aCount: UInt64);
procedure ResetSend(aStreamID, aErrorCode: UInt64);
procedure StopReceive(aStreamID, aErrorCode: UInt64);
procedure Close(aErrorCode: UInt64; const aReason: string);
Optional; implement it on the iHttp3ServerTransport object when the connection may accept 0-RTT. Before a request is admitted to a streaming route, the engine answers 425 if EarlyDataWindowOpen is True (late 0-RTT data can still be accepted on the connection) or StreamHasEarlyData is True (the stream has received 0-RTT bytes, delivered yet or not). It does not change the request's EarlyData flag.
function EarlyDataWindowOpen: Boolean;
function StreamHasEarlyData(aStreamID: UInt64): Boolean;
StreamAllowance, ConnectionAllowance, PeerUniAllowance: UInt64;
GuaranteedReceiveReserve, ReceiveTerminal: Boolean;
function TryGetReceiveLimits(aStreamID: UInt64; out aLimits: tHttp3ReceiveLimits): Boolean;
Optional cumulative client-bidi budget. The host reserves records for all granted IDs, including skipped IDs and pending unidirectional credit.
function GetStreamBudget(out aOpened, aGrant: UInt64; out aMetadata, aCeiling: Integer): Boolean;
function IncreaseStreamBudget(aGrant: UInt64): Boolean;
procedure RequestDrain;
SendWindowBytes: Integer;
MaxHeaderBlockBytes, MaxFieldSectionBytes, MaxBufferedSendBytes: Integer;
MaxActiveRequests, MaxRequests, MaxPeerUniStreams: Integer;
MinRequestBlockAgeMSec: Integer;
MaxBodyBytes, MaxConnectionBodyBytes, MaxMemoryResponseBytes: Integer;
MaxUnproductiveFrames: Integer;
QpackTableCapacity, QpackBlockedStreams, MaxQpackBlockedBytes: Integer;
MaxPushes, MaxActivePushes, MaxPushBufferedBytes, PushTimeoutMSec: Integer;
HeaderTimeoutMSec, RequestTimeoutMSec: Integer;
The HTTP/3 server engine for one QUIC connection. TsmHTTPSv3 creates and drives one per connection; use it directly only with your own QUIC host. Create it over your iHttp3ServerTransport and assign RequestHandler, which receives each complete request. With a Router, OnResolvedDispatch (if assigned) receives it instead, with the resolved handler; streaming routes (HTTP.txt section 24) also need Wake, OnWorkDeadline and iHttp3ServerTransportReceiveLimits, or they answer 503. Call Start when the handshake is authenticated with h3. Then report peer input in stream order with Receive or ReceiveEarly, and ResetReceived, StopReceived and TransportClosed as they happen; call Pump when the transport can send more, and WorkQueued when the time last reported by OnWorkDeadline (stTlsUtils.GetTickCount64 milliseconds, 0 for none) is due or Wake asks for it (Wake can be called on a worker thread and must only schedule that call). Without OnWorkDeadline, timeouts are checked only when you call in. Calls must come from one thread at a time. Handlers run inside the Receive or ReceiveEarly call that completed the request, with the whole body; they must not call back into this object. A failing response source resets only its own request. For a graceful close, see BeginDrain.
constructor Create(const aTransport: iHttp3ServerTransport; const aRemoteAddress: string); overload;
constructor Create(const aTransport: iHttp3ServerTransport; const aRemoteAddress: string; const aLimits: tHttp3ServerLimits); overload;
destructor Destroy; override;
function ReleaseStream(aStreamID: UInt64): Boolean;
function RetainedStreamCount: Integer;
function RequestBlockCount: UInt64;
procedure Start;
procedure Pump;
procedure WorkQueued;
property RemoteAddress: string read fRemoteAddress write fRemoteAddress;
procedure ObserveReceive(aStreamID, aStartedMS: UInt64);
procedure Receive(aStreamID: UInt64; const aData: TBytes; aFin: Boolean);
procedure ReceiveEarly(aStreamID: UInt64; const aData: TBytes; aFin: Boolean);
procedure ResetReceived(aStreamID, aErrorCode: UInt64);
procedure StopReceived(aStreamID, aErrorCode: UInt64);
procedure TransportClosed(aErrorCode: UInt64);
procedure BeginDrain(aFirstRejectedStreamID: UInt64);
property Ready: Boolean read GetReady;
property Closed: Boolean read fClosed;
property Draining: Boolean read fDraining;
property Drained: Boolean read GetDrained;
property SettingsReceived: Boolean read fSettingsReceived;
property QpackBlockedCount: Integer read fQpackBlockedCount;
property QpackBytesHeld: Integer read fQpackBlockedBytes;
property PeerSettings: tHttp3Settings read fPeerSettings;
property ActiveRequests: Integer read fActiveRequests;
property ActivePushes: Integer read fActivePushes;
property PushBytesHeld: Integer read fPushBytes;
property QueuedBytes: Integer read GetQueuedBytes;
property OutgoingTrailerBytesHeld: Int64 read fOutgoingTrailerBytes;
property TerminalSendBytesHeld: Integer read fTerminalRetainedBytes;
property TerminalSendParts: Integer read fTerminalParts;
property BodyBytesHeld: Integer read fHeldBodyBytes;
property TrailerBytesHeld: Int64 read fHeldTrailerBytes;
property MemoryResponseBytesHeld: Integer read fMemoryResponseBytes;
property Session: iHttpSession read fSession write fSession;
property ConnectionInfo: iHttpConnectionInfo read fConnectionInfo write fConnectionInfo;
property RequestHandler: tHttpRequestEvent read fRequestHandler write fRequestHandler;
property Router: iHttpRouter read fRouter write fRouter;
property SessionProvider: iHttpSessionProvider read fSessionProvider write fSessionProvider;
property Wake: iHttpServerWake read fWake write fWake;
property OnWorkDeadline: tHttp3DeadlineEvent read fWorkDeadline write fWorkDeadline;
property OnResolvedDispatch: tHttp3ResolvedDispatchEvent read fResolvedHandler write fResolvedHandler;
property StreamingWindowBytes: UInt64 read fStreamingWindows;
property DeadlineScanWork: Int64 read fDeadlineScanWork;
property BodyCharge: tHttp3ChargeMethod read fBodyCharge write fBodyCharge;
property BodyRelease: tHttp3ReleaseMethod read fBodyRelease write fBodyRelease;
property ResponseCharge: tHttp3ChargeMethod read fResponseCharge write fResponseCharge;
property ResponseRelease: tHttp3ReleaseMethod read fResponseRelease write fResponseRelease;