Search code examples
linuxubuntuopensslindylazarus

Lazarus Indy SSL IdHTTP


I'm trying to get Indy to work with SSL and the IdHTTP component in Lazarus installed on Ubuntu 11. I know my code is right for the http post since if I remove the https and leave it as only http it works. So I figure it's the SSL and indy's components missing Linux libraries. For window's I was use to just including the two DLL's, libeay32.dll and ssleay32.dll and it worked fine.

But in linux it seems to be another story. The only code I have is the post code:

IdHttp1.Post('url', StringList, ReturnStreamList);

Like I said it works great without the https, but when I try SSL nothing happens at all. No error since I have try and except to catch but I'm not doing anything with the catching.

I do have OpenSSL installed, I also have the following installed through apt:

libcrypto++8
libcrypto++-dev
libssl-dev
libssl0.9.8

I went to /usr/lib and both the files libcrypto.so and libssl.so are there.

Any ideas what's missing to get SSL to work with Lazarus and Indy for IdHTTP post operations?

EDIT: Ok, after following advice below I have added the exception:

on E: EIdHTTPProtocolException do
       showmessage(htp1.ResponseText);

This gives me the error Error creating SSL context.

EDIT2: I ran an strace and I have pasted the output areas where it open's the SSL libraries here: http://pastebin.com/fL6tTSGg


Solution

  • This was so easy it ticks me off! ha ha

    Seems I was using the wrong method for the SSL. I had to set TidSSLioHandlerSocketOpenSSL.SSLOptions.Method to sslvSSLv23, it was on sslvSSLv2.

    Now everything works fine :)