TsgcHTTP2Client › Properties › TLSOptions
Configures certificates, TLS version, ALPN, IOHandler and other secure-connection details used for HTTP/2 over TLS.
property TLSOptions: TsgcTCPTLS_Options read FTLSOptions write SetTLSOptions;
—
Used when TLS is True. Sub-properties include RootCertFile, CertFile, KeyFile, Password, VerifyCertificate, VerifyDepth, Version (from tlsUndefined through tls1_3), ALPNProtocols and IOHandler (iohOpenSSL, iohSChannel, iohAndroidTLS or iohAppleTLS). On Android, iohAndroidTLS uses the platform native TLS (javax.net.ssl.SSLEngine) and on iOS and macOS, iohAppleTLS uses Apple native TLS, so no OpenSSL libraries need to be deployed; native platform TLS requires the Enterprise edition. HTTP/2 requires ALPN to advertise the h2 protocol during the TLS handshake; the component populates the ALPN list with h2 automatically but ALPNProtocols can be extended if the server expects additional identifiers. OpenSSL-specific settings live under OpenSSL_Options and SChannel-specific settings under SChannel_Options. TLS 1.2 or higher is recommended for HTTP/2.
oHTTP2 := TsgcHTTP2Client.Create(nil);
oHTTP2.Host := 'http2.akamai.com';
oHTTP2.Port := 443;
oHTTP2.TLS := True;
oHTTP2.TLSOptions.Version := tls1_2;
oHTTP2.TLSOptions.VerifyCertificate := True;
oHTTP2.TLSOptions.RootCertFile := 'cacert.pem';