TsgcHTTP2ClientProperties › Proxy

Proxy 属性

通过 HTTP CONNECT 隧道或 SOCKS 代理服务器路由 HTTP/2 连接。

语法

property Proxy: TsgcTCPProxy_Options read FProxy write SetProxy;

默认值

Enabled=False, Port=8080

备注

Proxy.Enabled 设置为 True 并填写 HostPort,以通过中间代理隧道传输 HTTP/2 连接。由于 HTTP/2 需要客户端与服务端之间的端到端 TLS(或 TCP)管道,HTTP 代理通过 CONNECT 方法联系并简单地中继加密流。支持的代理类型(ProxyType)有 pxyHTTPpxySocks4pxySocks4ApxySocks5UsernamePassword 为可选项;匿名代理可留空。

示例


oHTTP2 := TsgcHTTP2Client.Create(nil);
oHTTP2.Host := 'http2.akamai.com';
oHTTP2.Port := 443;
oHTTP2.TLS := True;
oHTTP2.Proxy.Enabled := True;
oHTTP2.Proxy.Host := '80.55.44.12';
oHTTP2.Proxy.Port := 8080;
oHTTP2.Proxy.Username := 'user';
oHTTP2.Proxy.Password := 'secret';

返回属性