Forum > Other

[SOLVED] FreeBSD 12.0 - TFPHttpClient -OpenSSL- Access violation

(1/1)

trev:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function GetWebPage(const aURL: string): string;var  Client: TFPHttpClient;begin  Client := TFPHttpClient.Create(nil);   Try    Client.AllowRedirect := true;    Client.AddHeader('User-Agent', 'Mozilla/5.0(compatible; fpweb)');    Result := Client.Get(aURL);  except      on E: Exception do           ShowMessage('Retrieval of: ' + aURL + LineEnding                    + 'Failed with error: ' + E.Message + LineEnding                    + 'HTTP code: ' + IntToSTr(Client.ResponseStatusCode));  end;end; 
The above code results in the attached 'Access Violatioin' error dialog.

After much hair pulling I can no longer afford, I tracked the cause down to trying to make an HTTPS connection. HTTP connections work without error.

Yes, I have openssl installed (it's part of the FreeBSD 'base' code):


--- Code: ---trev@macfbsd [/home/trev] $ ldconfig -r | grep '[st][ls][ls]'
        103:-lssl.111 => /usr/lib/libssl.so.111
        394:-lgnutlsxx.28 => /usr/local/lib/libgnutlsxx.so.28
        397:-lgnutls.30 => /usr/local/lib/libgnutls.so.30
        419:-levent_openssl-2.1.6 => /usr/local/lib/libevent_openssl-2.1.so.6
        540:-lssl.5 => /usr/local/lib/compat/libssl.so.5
trev@macfbsd [/home/trev] $ ldconfig -r | grep crypto
        39:-lcrypto.111 => /lib/libcrypto.so.111
        477:-lcrypto.5 => /usr/local/lib/compat/libcrypto.so.5

--- End code ---

And I have the FPC openssl unit installed:


--- Code: ---trev@macfbsd [/home/trev] $ pkg info | grep -i openssl
fpc-openssl-3.0.4              Free Pascal unit for OpenSSL

--- End code ---

FPC 3.04; Lazarus 2.0 (from FreeBSD ports).

Any ideas why Lazarus/FPC cannot seem to find the openssl libraries which I'm assuming from my research is the underlying issue? (The same code works for macOS.)

rsz:
It's probably related to this nasty bug: https://bugs.freepascal.org/view.php?id=32789

I can't say for FreeBSD, but building and installing the latest FPC and Lazarus solved the issue for me on Ubuntu 19.04.

trev:
Thanks rsz, I'll give it a go and see what happens.

trev:
Yes! Updating to FPC 3.3.1 and adding the OpenSSLSockets unit to the project was the solution. Thanks again rsz.

Navigation

[0] Message Index

Go to full version