此代码:
uses
System.Net.HttpClient;
procedure TForm2.Button1Click(Sender: TObject);
var
LHTTP: THTTPClient;
LResponse: IHTTPResponse;
begin
LHTTP := THTTPClient.Create;
try
LHTTP.SecureProtocols := [THTTPSecureProtocol.TLS13];
LResponse := LHTTP.Get('https://tls13.1d.pw'); // TLS 1.3 ONLY site
if LResponse.StatusCode = 200 then
ShowMessage('TLS 1.3 worked');
finally
LHTTP.Free;
end;
end;
结果:
---------------------------
Debugger Exception Notification
---------------------------
Project Project1.exe raised exception class ENetHTTPClientException with message 'Error sending data: (12175) A security error occurred'.
---------------------------
Break Continue Help Copy
---------------------------
使用Windows 10(同样的代码适用于Windows 11)。我已经进入Windows中的“Internet选项”设置并启用了TLS 1.3,但这并不能解决问题。
还有什么需要我做的吗?