【发布时间】:2018-08-01 06:22:39
【问题描述】:
我这里有一个小程序,它使用 idHTTP 从 https 服务器下载一些东西。我需要更改此程序以使用 HTTPS 代理服务器。 我有两个代理的 IP 地址 1.1.1.1 8080 用于 HTTP 和 2.2.2.2 8084 用于 HTTPS 。
我将我的代码更改为如下所示:
try
IdHTTP1:=TIdHTTP.Create(nil);
try
LHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
try
// does not seem to do anything
LHandler.TransparentProxy.Host:='2.2.2.2';
LHandler.TransparentProxy.Port:=8084;
LHandler.TransparentProxy.Enabled:=true;
// this works even when using HTTP proxy for HTTPS
idHTTP1.ProxyParams.ProxyServer:='1.1.1.1';
idHTTP1.ProxyParams.ProxyPort:=8080;
IdHTTP1.IOHandler:=LHandler;
Src:= IdHTTP1.Get('https://csv.business.tomtom.com/extern?account='+company+'&username='+user+'&password='+password+'&apikey='+apikey+'&lang=en&action=showObjectReportExtern');
finally
LHandler.Free;
end;
finally
IdHTTP1.Free;
end;
except on E: Exception do
// Writeln(E.ClassName, ': ', E.Message);
end;
谁能告诉我如何告诉 idHTTP LHandler 使用 HTTPS 代理?
谢谢!
【问题讨论】:
标签: http delphi https proxy indy