Delphi HTTP/3 Client | QUIC & WebTransport Components | eSeGeCe

Delphi HTTP/3 Client — QUIC and WebTransport for Pascal

A working HTTP/3 stack for Delphi and C++Builder: TsgcHTTP3Client sends RFC 9114 requests over QUIC with QPACK header compression, Alt-Svc discovery, server push and Extended CONNECT tunnels. Raw QUIC transport components and WebTransport sessions are part of the same package, and an HTTP/3 server completes the picture.

Same HTTP semantics, new transport

HTTP/3 (RFC 9114) keeps the methods, status codes and headers you already know and replaces TCP with QUIC, a UDP-based transport with TLS 1.3 built in.

A Delphi HTTP/3 client gives your application the transport the modern web is moving to. QUIC (RFC 9000) combines the transport and TLS handshakes into a single flight, removes transport-level head-of-line blocking (a lost packet only stalls the streams whose data it carried), and survives network changes through connection IDs, so a connection can follow a device from Wi-Fi to mobile data. Headers are compressed with QPACK (RFC 9204), the HTTP/3 replacement for HPACK.

sgcWebSockets drives QUIC through the native QUIC support in OpenSSL 3.5. The engine is detected automatically when the OpenSSL library loads: with the shipped OpenSSL 3.5 binaries you get the qmBuiltin engine, which supports multiple streams per connection and is the engine the components are built around. A qmCustom path exists for quictls-style OpenSSL builds, limited to a single stream per connection.

HTTP/3 client

TsgcHTTP3Client: blocking and asynchronous requests, Alt-Svc, push, tunnels

HTTP/3 server

TsgcHTTP3Server: serves requests over QUIC, descends from TsgcQUICServer

Raw QUIC

TsgcQUICClient / TsgcQUICServer: QUIC streams without HTTP semantics

Standards

RFC 9000 (QUIC), RFC 9114 (HTTP/3), RFC 9204 (QPACK), RFC 9220 (Extended CONNECT)

What the HTTP/3 client can do

Ten HTTP methods, plus the HTTP/3-specific machinery exposed as events and methods.

All the verbs

GET, HEAD, POST, PUT, DELETE, PATCH, OPTIONS, TRACE, CONNECT and the new IETF QUERY method, each as a blocking call, most with an asynchronous variant too.

Alt-Svc discovery

Servers advertise HTTP/3 availability through the Alt-Svc header (RFC 7838). The client parses it and surfaces it through OnAltSvc, so your application decides when to switch.

Server push

The client stays in control of pushed responses: advertise a limit with SetMaxPushId, get notified through OnPushPromise and refuse with CancelPush.

Extended CONNECT

RFC 9220 tunnels another protocol through a request stream. ExtendedConnect opens the tunnel when the server advertises support; then TunnelSend and OnTunnelData move the bytes.

WebTransport

Sessions negotiated over Extended CONNECT that hand the application QUIC streams directly, built for low-latency bidirectional traffic. Stream-based; datagrams are not carried on the shipping QUIC engine.

QPACK compression

RFC 9204 header compression designed for QUIC's out-of-order delivery, with dynamic-table updates carried on dedicated encoder and decoder streams.

0-RTT-capable handshake

QUIC combines transport and TLS 1.3 into one flight; a fresh connection completes in a single round trip and a resumed session can carry 0-RTT data in the first flight.

Connection migration

QUIC connections are identified by connection ID rather than the address four-tuple, so they survive the client changing network.

Multiple streams

On the builtin engine, EnableMultiStream and OpenStream put several independent QUIC streams on one connection, the foundation WebTransport builds on.

A GET request over HTTP/3

Connect to a host and port, then issue requests. The default port is 443.

var
  oClient: TsgcHTTP3Client;
  vBody: string;
begin
  oClient := TsgcHTTP3Client.Create(nil);
  oClient.OnResponse := OnResponseHandler;
  oClient.OnAltSvc   := OnAltSvcHandler;

  oClient.Connect('www.example.com', 443);
  vBody := oClient.Get('https://www.example.com/');
  oClient.Disconnect;
end;
TsgcHTTP3Client* oClient = new TsgcHTTP3Client(NULL);
oClient->OnResponse = OnResponseHandler;
oClient->OnAltSvc   = OnAltSvcHandler;

oClient->Connect("www.example.com", 443);
String vBody = oClient->Get("https://www.example.com/");
oClient->Disconnect();
var oClient = new TsgcHTTP3Client();
oClient.OnResponse += OnResponseHandler;
oClient.OnAltSvc   += OnAltSvcHandler;

oClient.Connect("www.example.com", 443);
var vBody = oClient.Get("https://www.example.com/");
oClient.Disconnect();

An HTTP/3 server in Delphi

The server binds a UDP port, loads a certificate and key, and raises an event for every request. HTTP/3 support is also available on the HTTP server side of the library.

var
  oServer: TsgcHTTP3Server;
begin
  oServer := TsgcHTTP3Server.Create(nil);
  oServer.Port := 443;
  oServer.QUICOptions.SSLOptions.CertFile := 'cert.pem';
  oServer.QUICOptions.SSLOptions.KeyFile  := 'key.pem';
  oServer.OnH3Request := OnH3RequestHandler;
end;

Edition and runtime requirements

HTTP/3, QUIC and WebTransport are exclusive to the All-Access edition. The components require the Indy-based library core and OpenSSL 3.5 or later, which provides the native QUIC support they are built on.

WebTransport additionally requires the builtin OpenSSL QUIC engine (qmBuiltin), because a session needs several streams on one QUIC connection. The server components also run on the builtin engine only. Since a client cannot assume a server speaks HTTP/3, keep the HTTP/2 client at hand for origins that only advertise h2. The Alt-Svc event tells you when HTTP/3 is available.

Deeper dives

Delphi HTTP/2 client & server

The TCP-based sibling: multiplexed streams, HPACK, server push and WebSocket-over-HTTP/2.

HTTP components

The full HTTP family: HTTP/2, OAuth2, JWT, gRPC, push services and more.

Delphi comparison guide

How sgcWebSockets compares to other Delphi networking libraries, source-cited.

WebSocket component

WebSocket over HTTP/3 and QUIC (RFC 9220), HTTP/2 (RFC 8441) and HTTP/1.1 (RFC 6455).

Blog: The HTTP QUERY method

The new IETF verb across the HTTP/1.1, HTTP/2 and HTTP/3 clients, with code.

Editions

What each sgcWebSockets edition includes, from Standard to All-Access.

Best value: All-AccessEvery eSeGeCe product, Premium Support included, from €1,059/year.
See All-Access pricing

Try HTTP/3 from Delphi today

Download the trial and run the HTTP/3 client against your own server or any HTTP/3-enabled origin.