amitsq has asked for the wisdom of the Perl Monks concerning the following question:

I have written a Script which only downloads the content of a https page. On server side- via the terminal it works. On the Webpage (client side) it doesn't work.

Now with the portable version of Strawberry Perl 64 bit, I received the error msg when opening the webpage:

Can't load 'D:/Strawberry_Perl/perl/vendor/lib/auto/Net/SSLeay/SSLeay. +xs.dll' for module Net::SSLeay: load_file:called modul not found at D +:/Strawberry_Perl/perl/lib/DynaLoader.pm line 193. at D:/Strawberry_P +erl/perl/vendor/lib/IO/Socket/SSL.pm line 19. Compilation failed in r +equire at D:/Strawberry_Perl/perl/vendor/lib/IO/Socket/SSL.pm line 19 +. BEGIN failed--compilation aborted at D:/Strawberry_Perl/perl/vendor +/lib/IO/Socket/SSL.pm line 19. Compilation failed in require at D:/St +rawberry_Perl/perl/vendor/lib/Net/HTTPS.pm line 25. Can't load 'D:/St +rawberry_Perl/perl/vendor/lib/auto/Crypt/SSLeay/SSLeay.xs.dll' for mo +dule Crypt::SSLeay: load_file:called modul not found at D:/Strawberry +_Perl/perl/lib/DynaLoader.pm line 193. at D:/Strawberry_Perl/perl/ven +dor/lib/Net/SSL.pm line 20. Compilation failed in require at D:/Straw +berry_Perl/perl/vendor/lib/Net/SSL.pm line 20. Compilation failed in +require at D:/Strawberry_Perl/perl/vendor/lib/Net/HTTPS.pm line 29. C +ompilation failed in require at D:/Strawberry_Perl/perl/vendor/lib/LW +P/Protocol/https.pm line 8. Compilation failed in require at D:/Straw +berry_Perl/perl/vendor/lib/LWP/Protocol.pm line 68. .

I read that some people assumed a compartiblity problem, so I installed the PDL edition of Strawberry Perl likewise and the receiving error msg on the webpage is now:

 Can't locate object method "new" via package "LWP::Protocol::https::Socket" at D:/PerlPDL/perl/vendor/lib/LWP/Protocol/http.pm line 31.

of course i installed the modul via "cpan LWP::Protocol::https and cpan LWP::Protocol::https::Socket and LWP::Protocol"



In both tries the script is the same:
!d:\Strawberry_Perl\perl\bin\perl.exe use strict; use warnings; use LWP::Protocol; use LWP::UserAgent; use Mozilla::CA; use CGI qw(:standard); my $q= new CGI; print $q->header; my $B = new LWP::UserAgent (keep_alive => 1, agent => 'Mozilla/5.0', c +ookie_jar =>{}); print qq(@INC); my $proxy = 'http://vproxy.ab.de:80'; my $Skript = "http:\/\/$ENV{SERVER_NAME}$ENV{SCRIPT_NAME}"; $B->proxy( ['http', 'https'] => $proxy ); $ENV{HTTPS_PROXY} = $proxy; $ENV{'PERL_LWP_SSL_CA_PATH'} = "D:\\CA_certs\\input\\certs"; $B->ssl_opts( SSL_ca_file => Mozilla::CA::SSL_ca_file() ); $B->ssl_opts( verify_hostname => 0 ); my $GET = $B->get('https://moz.com ')->content; print $GET, "<br>";

Replies are listed 'Best First'.
Re: Download of https Pages
by roboticus (Chancellor) on Oct 26, 2017 at 13:53 UTC

    amitsq:

    I'm guessing that the web server isn't running on the same account you're using at the command line. In that case, it's time to compare the web server account settings against yours to find out where the difficulty lies. Typically it'll be something like:

    • The web server perl may be different than the perl you're running on your account.
    • The environment (exe path, lib path, include path, ...) is different and you'll need to make the appropriate adjustments.
    • The web server account may have insufficient permissions to access some directory containing the code (such as D:/Strawberry_Perl/perl/vendor/lib/....).

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Thanks for your reply
      1) no already checked on that, it's the same perl, because it output the same when :
      print qq(@INC);
      2) could you give an example for that? I don't think enviroment variables plays a role since i'm using the local batch command line when running a script on the command line.
      3)no, the permissions are given and no difference
      btw the problem only problems occur with https pages, with http pages it works.

        There's a difference between running something as a logged in user on a command prompt and having a webserver that runs as a user, with sites/app pos that can be configured to run as other uses in restrictive manners. If you want to use IIS you need to learn how this platform works. Also, you don't have to create a new thread for an existing issue.

Re: Download of https Pages
by haj (Vicar) on Oct 26, 2017 at 19:55 UTC
    A rather obvious check: The error messages reads:

    Can't load 'D:/Strawberry_Perl/perl/vendor/lib/auto/Net/SSLeay/SSLeay.xs.dll'

    so please check whether that file exists on your client side. If it does and isn't empty (it should have about 350kB), check if your client side computer has a security policy or security product, e.g. a virus scanner, which prevents loading "unknown" dlls. You can boil down the test to one single line of code:

    use IO::Socket::SSL;

    Good luck!
Re: Download of https Pages
by Anonymous Monk on Oct 26, 2017 at 14:03 UTC
    It is quite likely simply to be that some CPAN package – Net::SSLeay? – isn't installed on that system. Or that, in some other way, the Perl environments are not configured in exactly the same between the two.

      It's the same system, same perl. It's not a missing module.

      thanks for your reply, Net::SSLeay is installed.
      I didn't really do anything about the perl env. I just executed the batch script. And for the webpage i set the path to perl via "adding Handler".

        You need to stop doing things you don't understand and learn how to use/calibrate the tools you've chosen to use.

        amitsq:

        Did you find a solution? I have the *exact* same problem.