Show quoted text> <rant>I really start wondering now why most germans are so unhelpful
> and don't understand the simple technical issues and solutions
> behind.</rant>
I feel sorry for you that you have this kind of experiences.
These germans must be really terrible.
Show quoted text> Only the compile-time dh handle is a problem, not any other
> Net::SSLeay handles. And only IO::Socket::SSL is to blame, not any
> other causes.
I will try to illustrate my point with a simple code:
use IO::Socket::SSL;
my $cl = IO::Socket::SSL->new("www.google.de:443") or die "$!,$SSL_ERROR";
print $cl->peer_certificate("subject");
This code connects to google and prints the certificate information. It works fine with plain perl, e.g. without perlcc. It also compiles without problems with perlcc but the compiled program will not work. It will not crash (there is is SSL_dh* on the client side, so it is not affected by the issue) but it will not be able to SSL connect to google.
But, if you add Net::SSLeay::add_ssl_algorithms() before trying to connect, the compiled version will work too because this function initializes the internal OpenSSL structures. And while these structures already got initialized by calling this function inside IO::Socket::SSL during compile time, the initialization got lost during compilation with perlcc because it is inside a C library and not in Perl variables.
With the argumentation from
https://github.com/noxxi/p5-io-socket-ssl/pull/13 one should move the OpenSSL initialization from compile time to run time, i.e. do it on first use like done with SSL_dh in this patch. But inside a multithreaded program the first use might not happen in the main thread, which might cause the application to crash (see thread safety documentation for Net::SSLeay and OpenSSL).
So a safe place might be to do any such initialization but before run time, so that it will be the first thing the compiled binary does, i.e. before executing any user code which depends on the finished initialization. From experiments with perlcc it looks like, that INIT would be the correct place to do this, am I right? In this case I could reopen the bug and try to move all the initialization into INIT.
Regards,
the terrible german.