How to ignore ssl with WinHttp.WinHttpRequest.5.1

60 views
Skip to first unread message

Иван Никитаев

unread,
Oct 15, 2021, 8:43:29 AM10/15/21
to innosetup
Hello. On windows 7, an ssl certificate error occurs, I can't figure out how to ignore the ssl certificate check in any way.

My code
```
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
  WinHttpReq: Variant;
begin
  Result := '';

  WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
  WinHttpReq.SetTimeouts(3000, 3000, 3000, 3000);
  WinHttpReq.Open('GET', 'https://site..', False);

  // This should be responsible for ignoring ssl, but it doesn't work
  WinHttpReq.Option(4) := 13056;

  try
    WinHttpReq.Send('');
  except
    Result := GetExceptionMessage;
    Exit;
  end;
end;
```
Error result in attach
1634301703411.png

Jernej Simončič

unread,
Oct 16, 2021, 9:20:26 AM10/16/21
to Иван Никитаев on [innosetup]

On Friday, October 15, 2021, 14:43:29, Иван Никитаев wrote:


Hello. On windows 7, an ssl certificate error occurs, I can't figure out how to ignore the ssl certificate check in any way.
Are you sure it's a certificate error, and not a protocol error? Modern web servers usually only support TLS 1.2 and 1.3, while Windows 7 in default settings only supports TLS 1.0 (it's possible to enable TLS 1.2 support, but an update and a Registry change are both needed).

 

Note that you should never ignore certificate errors, as those usually mean that something's interfering with the connection, so you definitely shouldn't trust any file downloaded through such connection.

 

Also, is there any reason you're not using Inno's built-in DownloadTemporaryFile or CreateDownloadPage?


-- 
< Jernej Simončič ><><><><>< https://eternallybored.org/ >


Food that tastes the best has the highest number of calories.
       -- Dieter's Law
Reply all
Reply to author
Forward
0 new messages