Search code examples
delphisslidhttp

Error connecting with ssl. Eof was observed that violates the protocol


I want to get data from the site https://exergy.skmenergy.com. I use TIdHttp. My settings

  FHttp := TIdHTTP.Create(nil);
  FSSLIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  FSSLIOHandler.MaxLineAction := maException;
  FSSLIOHandler.SSLOptions.Method := sslvSSLv23;
  FSSLIOHandler.SSLOptions.Mode := sslmUnassigned;
  FSSLIOHandler.SSLOptions.SSLVersions := [sslvSSLv2, sslvSSLv3, sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];

  FCookie := TIdCookieManager.Create(nil);

  with FHttp do
  begin
    IOHandler := FSSLIOHandler;
    CookieManager := FCookie;
    AllowCookies := True;
    HandleRedirects := True;
    Request.BasicAuthentication := True;
    if StrToBoolDef(FParam.Items['ProxyUse'], True) = True then
    begin
      ProxyParams.ProxyPort := StrToInt(FParam.Items['Port']);
      ProxyParams.ProxyServer := FParam.Items['Server'];
      ProxyParams.ProxyUsername := FParam.Items['Login'];
      ProxyParams.ProxyPassword := FParam.Items['ProxyPassword'];
    end;
    ReadTimeout := 100000000;
  end;

But in code i call from thread

FHTTP.Get('https://exergy.skmenergy.com);

I get an error Error connecting with ssl. eof was observed that violates the protocol delphi. UPD

enter image description here

Files libeay32.dll and ssleay32.dll include in project. Version 1.1.0.1 I use Embarcadero® RAD Studio 10.2 Version 25.0.29039.2004


Solution

  • Indy does not support OpenSSL 1.1.xx.

    Need to use OpenSSL version 1.0.2 https://github.com/IndySockets/OpenSSL-Binaries