1,593
社区成员




function TCTCC_WebAPI_NBIOT.CreateIdHttp: TCustomIndyHttp;
var
AIOHandler: TIdSSLIOHandlerSocketOpenSSL;
begin
Result := TCustomIndyHttp.Create(nil);
Result.AllowCookies := True;
Result.HandleRedirects := True; // 允许头转向
Result.ReadTimeout := 5000; // 请求超时设置
Result.ConnectTimeout := 15000;
Result.Request.ContentType := 'application/json';
Result.Request.UserAgent := 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)';
Result.Request.Accept := '*/*';
AIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
AIOHandler.SSLOptions.CertFile := 'CTCC.pem'; // 'my.crt'; // assign certificate
AIOHandler.SSLOptions.KeyFile := 'CTCC_key.pem'; // 'my.key'; // assign private key
AIOHandler.SSLOptions.SSLVersions := [sslvTLSv1_2];
Result.IOHandler := AIOHandler;
end;
indy要pem格式的证书,需要你自己转换下