TsgcWebSocketHTTPServer › Properties › HTTP3Options
Enables the HTTP/3 (QUIC) listener that serves HTTP requests alongside HTTP/1.1 and HTTP/2, over UDP.
property HTTP3Options: TsgcWSHTTP3Server_Options read FHTTP3Options write SetHTTP3Options;
Enabled=False, Port=0, AltSvc.Enabled=True
By default the server does not listen for HTTP/3. Set HTTP3Options.Enabled to True to open a QUIC listener alongside the existing TCP/TLS listener; it requires the certificate and key already configured in SSLOptions (CertFile/KeyFile — an encrypted private key is not supported for this listener) and OpenSSL 3.5 or later. Port sets the UDP port the listener binds to; leave it at 0 to reuse the port already set in SSLOptions.Port. Requests arriving over HTTP/3 are dispatched through the same DocumentRoot static file serving and the same OnCommandGet and OnCommandOther events used for HTTP/1.1 and HTTP/2, so existing request-handling code mostly just works; two differences to code for: ARequestInfo.Version reports 'HTTP/3' for these requests, and the AContext parameter passed to the handler is nil (there is no TCP connection behind an HTTP/3 request), so any code that dereferences it must guard for this case. AltSvc.Enabled (on by default) makes HTTPS responses carry an Alt-Svc header advertising the HTTP/3 endpoint once the listener is running, so browsers and clients can discover it and switch over on their own; it combines with the HTTP/2 Alt-Svc advertisement into a single header when both are enabled. Authentication.Basic is enforced on HTTP/3 requests; sessions, OAuth2 and JWT authentication and request forwarding are not applied to them in this version. If the HTTP/3 listener fails to start — port in use, missing or invalid certificate, OpenSSL 3.5 not available — the regular HTTP/1.1 and HTTP/2 server keeps running unaffected and the failure is reported through OnException. Building with HTTP/3 support requires the HTTP3 pack compiler directive to be enabled.
oServer := TsgcWebSocketHTTPServer.Create(nil);
oServer.SSL := true;
oServer.SSLOptions.CertFile := 'c:\certificates\mycert.pem';
oServer.SSLOptions.KeyFile := 'c:\certificates\mycert.pem';
oServer.HTTP3Options.Enabled := true;
oServer.Active := true;