Hire a senior Perl / Python programmer today; download my up-to-date resume (PDF)
John Bokma Perl
freelance Perl programmer

Comments: HTTPS protocol with ActiveState Perl


If you want to access URIs that use the https protocol via Perl you need to install SSL support. ActiveState's repository has no SSL Perl module(s) available so you can't install it using the default settings with ppm. A solution is to use the excellent Perl repository of the University of Winnipeg.

Read the rest of HTTPS protocol with ActiveState Perl.


Thanks, I had a script which broke, and I had forgotten about all the 'good stuff' being at uwinnipeg.

Cheers -bob c

Posted by Bob C at 15:17 GMT on 25 June 2005

Thanks for link to perl SSL. Was able to get scripts to work with SSL urls in minutes with ActiveState perl.

Posted by ed at 16:00 GMT on 29 June 2005

I'm having trouble with this... I'm on an XP machine, so perhaps that's it...

I'm using ActiveState Perl 5, build 881 running on an XP professional system.

I was able to install the SSL module as described, except the order of file installation was a little different (probably no big deal) and this:

A copy of the needed library ssleay32.dll was found in
C:\WINDOWS\system32. If this is compatible with the version
(0.9.7g) used to compile the Perl module, all that is needed
to complete the installation is to ensure
C:\WINDOWS\system32 is in your PATH environment variable.

Fetch ssleay32.dll? [no]
Aborting download of ssleay32.dll.
Successfully installed Crypt-SSLeay version 0.51 in ActivePerl

It never prompted me to do anything, it just stopped. I exited ppm and ran the test script you provided. Instead of giving the Perl errors, I get a popup error that says:

The ordinal 3212 could not be located in the dynamic link library

I downloaded the DLLs provided and tried to see if that would work, no joy. I've thrice-checked my PATH to make sure it's correct and it is.

Any ideas?

Thanks -mike

Posted by Mike at 14:21 GMT on 5 July 2005

I got it to work! Yes... 20 seconds AFTER emailing you. heh. Anyway, I replaced the version of the DLL files I had with the ones you provide for download and it worked.

Thanks, sorry to bug you =] -mike

Posted by Mike at 14:26 GMT on 5 July 2005

No worries Mike. I leave your first post here in case other users encounter this problem as well.

By the way, I don't provide the download, I just wrote the how to.

Posted by John Bokma at 17:41 GMT on 6 July 2005

Hi John,

I'm having problems getting the https example to work. I am trying to connect to www.helsinki.fi through a proxy. connecting to the proxy is ok but I get the following error message.

"500 SSL negotiation failed"

I have been hunting around the net trying to find a solution without success.

Posted by Gavin at 15:11 GMT on 13 July 2005

Great! Does this also make HTTP::Daemon support SSL connections? Because that is what I need.

Posted by Lyle Kopnicky at 05:34 GMT on 15 July 2005

I am also having a problem with the Crypt-SSLeay module on Window XP Professional as well runing ActiveState Perl I am able to download and install the Crypt-SSLeay module from uwinnipeg and install the dlls in the /Perl/bin directory. However, when I run the perl script, I get the "Ordinal Not Found" popup box that says "The ordinal 3212 could not be located in the dynamic link library LIBEAY32.dll." Once I click OK, the script runs normally. This would be acceptable if I was always running the script from the command line but I intend to make the script automated and this behavior might make that impossible.

I have checked my path and c:\Perl\bin is the first thing in it. Can you let me know if there is something else I can do to solve this problem?

Thanks! Collin

Posted by Collin at 17:26 GMT on 15 July 2005

Hi all,

I have one problem,please help me out. I am not able to understand ,how one can post the https page.Getting the https page is fine,it is working. Can you just let me know wt modules are required and what is the syntax for the post operation.

Regards, Chirag

Posted by chirag at 10:17 GMT on 22 August 2005

I just fixed the "Ordinal 3212" problem on my XP machine.

(1) I did a search for all occurrences of LIBEAY32.DLL and SSLEAY32.DLL. Some were in C:\i386, others in C:\Windows\System32, and still others in C:\Perl\bin.

(2) I renamed the DLLs found in C:\i386 and in C:\Windows\System32 to remsuffix_LIBEAY32.DLL and remsuffix_SSLEAY32.DLL so that only the DLLs in C:\Perl\bin would be loaded. (Rename is safer than delete, but if you're an optimist, I suppose you could delete rather than rename.)

Posted by Dave Featherstone at 21:25 GMT on 26 August 2005

I did not see an error message about "Ordinal 3212" when I installed Crypt-SSLeay, however I did get serveal warnings during the install...

A copy of the needed library ssleay32.dll was found in C:\WINDOWS\system32. If this is compatible with the version (0.9.7g) used to compile the Perl module, all that is needed to complete the installation is to ensure C:\WINDOWS\system32 is in your PATH environment variable.

I saw a simimar message for libeay32.dll. When I ran the test script, I kept getting messages that Crypt:SSLeay was not installed. So aparently the pre-existing ssleay32.dll and libeay32.dll were there from some other program that I had already installed and were *not* compatible with ActiveState Perl. Once I renamed the two files located C:\WINDOWS\system32, the proper DLLs located in my Perl directory were getting called and my Perl scripts started working. The $64 question now is, I wonder what program I just broke by renaming the two DLLs in C:\WINDOWS\system32.

Posted by spunk at 16:17 GMT on 2 September 2005


Thanks for the instructions, however I am having trouble getting the example script to work.

I have a XP machine, and when I run the script I get the following error: Failed to GET 'https://www.helsinki.fi/':500 Connect failed: connect: Unknown error;

I have changed the code slightly and inserted the following before the $ua->get()

$ua->proxy( 'http' , 'http://<my proxy address>:<my proxyport>' );

Thanks in advance for any help.


Posted by Pubs at 22:54 GMT on 6 September 2005

I am having problems connecting to Helsinki using this package. I'm trying to test connecting to the https://www.helsinki.fi page via a proxy. I am able to reach an http://google.com just fine.

The error message I get is:

HTTP Error: 500 Can't connect to www.helsinki.fi:443 (Bad hostname 'www.helsinki.fi')

Posted by unk1911 at 18:30 GMT on 14 September 2005

Hi, I followed the instruction to rename the libeay32.dll and ssleay32.dll every where except in /perl/bin. I also follow instruction posted by Spunk to set env_proxy And I still have errors 500 connect: unkown error 500 SSL negotiation failed

Please help,

Thanks, Hoang

Posted by Hoang at 16:29 GMT on 22 September 2005

Thanks for posting the instructions for getting this up and running (we'll see if they work on my system!). The only remaining question for the moment is why in jeebus' name ActiveState doesn't provide this support.


---Michael B.

Posted by Michael Bolton at 13:37 GMT on 25 October 2005

Great! Once I renamed the DLL's in c:\windows\system32 it worked fine.



Posted by wim at 10:12 GMT on 9 November 2005

Hey guys,

I'm having the same (or similar) problem as another poster. I get the following:

500 Connect failed: connect: Unknown error; Unknown error

This machine uses a proxy, but I am able to get normal http web pages to work, so I think the proxy is set up ok.


Posted by WorknMan at 14:39 GMT on 13 January 2006

Hi guys. I found the solution for the very annoying ordinal problem. That is: A solution OTHER than removing the offending different version DLLS from the windows directory.

I have a wxPerl app that I ship as an executable (with PerlApp and inno setup) and I can't just go around deleting other people's DLLs without permission.

I discovered that changing PATH doesn't work, but you CAN fix this with a chdir to the directory containing your versions of the dll's before loading Crypt::SSLeay and then chdir-ing back. Like this:

use Cwd;
use FindBin;

my $lastdir=getcwd();   
eval "use Crypt::SSLeay";
$ssl=($@ ? 0 : 1);

I found this solution while looking through the faqs on the GAIM website which has a similar problem with a different dll.

Hope this helps, X

Posted by Xenna at 18:12 GMT on 8 February 2006

The installation went exactly as you described, but when I run the test script, perl exits without printing wither the HTTPS response or an error message.

In running Windows 2003 Server with ActiveState perl 5.8.7.

Any idea what could cause this?

Posted by Jonathan Turkanis at 04:52 GMT on 5 March 2006

This all looks very interesting, but I recall when looking at the SSLeay module a few years ago that there were Licensing issues with the encryption. Something like, it's OK to use this module in Australia, but risky (from a Licensing point of view) in the U.S. Anybody know anything about this?

Posted by Gerry at 03:24 GMT on 6 April 2006

It worked like a charm for me!

Question though...what is the lifetime of the perl module? Will the University of Winnipeg continue to have this posted? Also historical, why doesn't cpan have it? Is it due to politics?


Posted by OmegaMan at 19:50 GMT on 11 May 2006


Despite an installation as specified in the initial message, I had a 'crypt::ssleay lib not installed' error.

I searched for and renamed every occurence of LIBEAY32.DLL and SSLEAY32.DLL as Chirag did to fix the Ordinal issue.

It works fine, now.

The chdir method proposed by workman is more beautiful and should be applied when you don't want to corrupt the other applications that had installed the 2 dlls.

A big thanks for your help. Jerome

Posted by Jerome at 00:49 GMT on 21 May 2006

Oups! the chdir solution was provided by Xenna not WorknMan.... Sorry


Posted by Jerome at 01:01 GMT on 21 May 2006
use strict;
use warnings;

use LWP::UserAgent;
use Crypt::SSLeay;

my $url = 'https://www.helsinki.fi/';
print "Url to $url\n";

my $ua = LWP::UserAgent->new or die "Problem with the new Useragent\n";
print "New LWP\n";
my $response = $ua->get($url) or die "Problem with the get $url\n";
print "Getting responce\n";
$response->is_success or
    die "Failed to GET '$url': ", $response->status_line;
print "About to print the html\n";

I've put in the above code on a Solaris 2.6.15 machine, and i get the following problem:

$ ./https_get.pl
Url to https://www.helsinki.fi/
Segmentation fault

Any ideas? Or am i barking up the wrong tree with this on Solaris?


Posted by Mark MS at 08:53 GMT on 24 May 2006

Great write-up. I added a line to print "Content-type: text/html\n\n" so I could run the script from a browser, but am having a wierd problem. When I run the script from a DOS command prompt, I get the output exactly as expected. (It prints out the content header as well as returns all of the HTML) If I run it from a browser, though, "//localhost/ssl.pl" I get the error message "Failed to GET 'https://www.helsinki.fi/': 501 Protocol scheme 'https' is not supported (Crypt::SSLeay not installed) at c:\inetpub\wwwroot\ssl.pl line 18." Is there any reason why running the script from a DOS prompt finds the module, but running it through IIS does not? I can't figure it out. Thanks for any help.


Posted by Seth Horwitz at 18:23 GMT on 4 June 2006

I am trying to use https and have tested the sample script with 'https://www.helsinki.fi/' successfully. My problem is with credentials.

here is my script:

use strict;

use HTTP::Request::Common;
use LWP::UserAgent qw($ua);
use LWP::Debug qw(+);

my $pw = shift @ARGV;
my $ua = LWP::UserAgent-> new;
$ua-> credentials("https://transerv1.someserver.com",
    'WWW-Authenticate', "user" => $pw);  # authentication
$ua -> no_proxy;
my $request =HTTP::Request-> new(GET =>
my $response =$ua-> request($request);
LWP::Debug::conns("Get Response");

print "Response is: ".$response-> status_line."\n";
if ($response-> is_success) {
    print "Successfully got file\n";
else {
    $response-> status_line;

I am getting:

Peer certificate not verified
Unsupported authentication scheme 'ntlm'
You are not authorized to view this page
Return Code: 401

My problem is probably with the $ua-> credentials("https://transerv1.someserver.com", 'WWW-Authenticate', "user" => $pw); statement

Any help most appreciated!

Posted by MartyDavis at 19:12 GMT on 5 June 2006

@Seth - my best guess is that IIS, running as a special user (IUSR_XXXX with XXXX the name of the machine), is not allowed to read the required DLL(s) needed for SSL. I doubt it has problems with loading the Crypt::SSLeay module.

What you could try is see if you can open the DLL(s) from a script you run in IIS. My guess is you can't, and in that case you can give the IUSR_XXXX reading rights to the DLL(s)

Posted by John Bokma at 19:28 GMT on 5 June 2006

@MartyDavis - ntlm is an authentication scheme used by Microsoft.

I checked CPAN, and found: LWP::Authen::Ntlm. I guess installing it will fix your problem.

Posted by John Bokma at 19:28 GMT on 5 June 2006

I used the LWP::Authen::Ntlm module and fiddled with the code having authentication problems until I specified the https port 443.

It works.

I am very greatful for the help. I looks like I will be having to do more https downloading and will keep an eye on your site.

I might have some small projects if you are interested.

Thanks again

Posted by MartyDavis at 20:00 GMT on 6 June 2006

@MartyDavis - I am always interested in small (Perl) projects.

And I am glad it works.

Posted by John Bokma at 03:57 GMT on 14 June 2006

Thanks for the guide John.

It worked perfectly for me on Win32, and setting the perl/bin/ into the system path, my perl compilation is portable too.

However, on linux (FC4) I get the error message "Error: no suitable installation target found for package Crypt::SSLeay"

and searching through the Activestate bug tracker, this bug is usually indicating that the build of perl is different from the build of the package I am trying to install. (Although it is the same as the build which just worked fine on win32)

any suggestions? =( has anyone got Crypt::SSLeay to work on linux?

Posted by Nemtaro at 14:10 GMT on 11 August 2006

For those on Windows XP experiencing the "Can't load 'C:/Perl/site/lib/auto/Crypt/SSLeay/SSLeay.dll' for module Crypt::SSLeay: load_file:The operating system cannot run %1 at C:/Perl/lib/DynaLoader.pm" error, I believe I have found 2 separate solutions:

Solution #1) copy the 2 DLL's into C:\Windows\System32, as described above

Solution #2) copy the 2 DLL's into C:\Perl\site\lib\auto\Crypt\SSLeay

Personally, I prefer #2 just in case other programs still need the existing one in the system32 folder to function properly

Posted by Tom Dierickx at 03:00 GMT on 2 September 2006

I installed that package on ActivePerl it and worked just fine out of the box even though I have quite a few copies of those DLLs on my machine.

Posted by Stéphane Lenclud at 18:54 GMT on 23 October 2006

Since i wasn't able to find the solution anywhere on the web to the 500 problem people are encountering, i thought i would post my solution here .. Stop error handling. That's what causes the problem, you are actually connected fine, its the if($Response->is_success) that causes the problem .. for those getting the 500 error try your connection without the error checking.

Posted by idioms at 00:24 GMT on 7 November 2006


I am getting this error in winXP while i use LWP in module

"The ordinal 113 could not be located in the dynamic link library SSLEAY32.dll"

Please how to resolve this?

Thanks Uthay

Posted by uthay at 05:14 GMT on 27 November 2006

I get the following error appear several times when I try to install the package ...

Element 'IMPLEMENTATION' cannot contain a child element 'PROVIDE' at
c:/Perl/site/lib/PPM.pm line 1703, <> line 4.

Anyone have any ideas on this one? I am trying to install this with Perl version 5.6, so that might be the problem. Although, I would expect a different error if that were the case.

Posted by Marc at 19:29 GMT on 28 November 2006

Install worked fine. When I try to run the test script I get an error saying "VSINIT.dll not found. Re-installing the application may fix this problem" Im running active state 5.8.8 build 817 on Win Xp home. The two dll's ssleay32.dll and libleay32.dll are both in the perl/bin dir which is also in the path statement. While writing this I copied the 2 dll's to the windows/system32 dir for the hell of it and it worked. May want to post this for others who may have this issue. Seems the path statement may not be what is used to locate the two dll's. Its 4 am so Im crashing out. see ya.

Posted by Dave at 10:46 GMT on 6 December 2006

Thx for all this. I googled the whole web, tried to compile openssl myself and finally found this website. Just a few minutes to get it work, great!!

Posted by Lasse at 20:13 GMT on 26 December 2006

Hi All,

I am trying to install the Crypt:SSleay but am faced with lot of problems. I am using Activeperl V5.8.8. on WIndows XP. I have succefully installed the Openssl on my system. I am trying to install the module using ppm. Following are the steps i followed.

1) Installed Openssl from Openssl.org. 2) Downloaded the Crypt::SSLeay module from the in .tar format and unzipped the files into c:/perl/lib/Crypt-SSLeay-0.53 folder. 3) Downloaded the Nmake15.exe and ran it in the above directory. 4) Then using the Nmake.exe tried to create the ppd but the following exception was thrown!

Microsoft (R) Program Maintenance Utility Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
cl -c -Ic:\openssl\include -Ic:\openssl\inc32 -nologo -GF -W3 -MD -Zi
" "-IC:\Perl\lib\CORE" SSLeay.c
'cl' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code

I also tried another method

1) I tried ppm> install http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd but i got the following error!

ppm install failed: 404 Not Found

for this i also have set HTTP_proxy ,HTTP_proxy_usr and HTTP_proxy_pass environment variables... but still i get the same error.

I tried downloading this ppd and store it on my local machine and then re fire the install c:/Crypt-SSLeay.ppd but that too doesn't work.

CAn somebody point out wher am i going wrong!

Thanks and regards Dixit

Posted by Dixit at 12:32 GMT on 8 January 2007

@Dixit - the "'cl' is not recognized as an internal or external command" error happens because you have no C compiler on your system, or Perl is not able to find it.

If you can't access a ppd via ppm but can download using a browser something very odd is happening. Downloading the ppd manually is not going to work because the pdd points to two files:

You might be able to install Crypt::SSLeay by downloading manually, but I think it's more important to find out why ppm is not working correctly.

Are you able to install modules from CPAN using ppm?

Posted by John Bokma at 21:00 GMT on 19 January 2007

@Marc - Based on the error "Element 'IMPLEMENTATION' cannot contain a child element 'PROVIDE'", which has to do with the ppd version, you picked the wrong version.

For ActivePerl builds 6xx use:

ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/Crypt-SSLeay.ppd

For ActivePerl builds 8xx use:

ppm install http://theoryx5.uwinnipeg.ca/ppms/Crypt-SSLeay.ppd

I've added this information to the article itself as well.

Thanks for the feedback.

Posted by John Bokma at 21:16 GMT on 19 January 2007

Thanks so much! 2:40am, found your help page. 2:44am, everything works great.

Posted by Carl at 11:43 GMT on 29 January 2007

Thank you ! It is very useful with comments !!!

Posted by I. Kovalchuk at 09:22 GMT on 1 February 2007

Thanks so much for this - I was trying all morning to get Crypt::SSLeay installed and this finally got it for me! Really appreciate it!

Posted by Jbox1 at 18:16 GMT on 4 February 2007

For everyone that use a proxy, try to modify the code in this way (this fixed the problem in my case):

my $ua = LWP::UserAgent->new;

 $ENV{HTTPS_PROXY} = "<my proxy address>:<my proxyport>";
 $ENV{HTTPS_PROXY_USERNAME} = '<my domain>/<my username>';
 $ENV{HTTPS_PROXY_PASSWORD} = '<my password>';  
my $response = $ua->get( $url );


Posted by Cris at 10:23 GMT on 20 March 2007

I want to connect to https site and i need provide the user name and password for authentication. I am able to connect to the https site those don't prompt for userid and password, but i am unable to access site if it prompt for username i tried with proxy_authorization_basic method, but its not working. I am getting error as Error 401, access denied

Posted by Jay 123 at 12:53 GMT on 17 October 2007

Great deal.

Your description, how to install sslleay is very easy to handle. I've tried to install sslleay manually for hours and it failed again and again.

Thanks a lot.

Kind regards, Norbert

btw: When authorization to a website is required (error code 401), modul http mechanize is very helpfull. Please see this simple sample:

#!C:/Perl/bin/perl.exe -w
use strict;
use Crypt::SSLeay;
use WWW::Mechanize;

my $mech = WWW::Mechanize->new( autocheck => 1 );
$mech->credentials( $ARGV[1], $ARGV[2]); # user + pw
$mech->get(   "https://......."); # enter URL here
my $page = $mech->content( format => 'text' ) ;

print "\n".$page;
Posted by norbert at 07:43 GMT on 21 October 2007

Hi everyone,

I need to access an HTTPS site that requires client certificates for authentication.I'm using Crypt::SSLeay and keep getting the error: OPENSSL_Uplink<022A9010,06>: no OPENSSL_Applink. but I was able to access a different https site that did not use client certification. Here is the relevant part of my code:

use strict;
use LWP::UserAgent;

$ENV{HTTPS_PKCS12_FILE}     = 'test.p12';
$ENV{HTTPS_PKCS12_PASSWORD} = 'password';

my $ua = new LWP::UserAgent;
my $req = new (HTTP::Request'GET', 'https://example.com');
my $res = $ua->request($req);
print $res->status_line."\n";

I'm running on ActiveState 5.8 using Crypt::SSLeay from theoryx5. Could

anyone tell me what I'm doing wrong?


BingShu Ni

Posted by Ni at 23:11 GMT on 27 October 2007

Hi frens,

i am also getting problems with ssl module installation in perl (Windows xp os).

plz anyone help me by providing detailed steps to install that module (or) manual steps to place the files into perl installation directory. plz provide me as i need it urgently.....

Thanks in advance

Posted by mamph02 at 12:19 GMT on 20 November 2007


I'm getting a similar error trying to use a client certificate. Likewise, I have an exsiting download over https (without client cert) that works, but now tring to access a site that requires one. Error I get is: [code] OPENSSL_Uplink(01A04010,06): no OPENSSL_Applink [/code] Using Active state

Seems to be linked to including the PKCS12 env vars to point the script to the cert.

Anyone have any ideas on this issue?



Posted by ash at 14:45 GMT on 20 November 2007


I am getting this error while installing flash cs3

"The ordinal 113 could not be located in the dynamic link library SSLEAY32.dll"

Please how to resolve this?

Thanks Uthay

Posted by geroge at 19:09 GMT on 22 December 2007

I trie to rename the original ssleay32.dll to test_ssleay.dll reboot the XP client. But when i check a https site on the command line, i recieve a error from the Perl command line interpreter "AppName: perl.exe AppVer: ModName: ssleay32.dll ModVer: Offset: 00017e3c"

what's happend?

Posted by amdpp at 15:14 GMT on 11 January 2008

Post a comment

Note that your comment doesn't show up immediately. I review each comment before I add it to this site.

Check the Follow this page option if you want to receive an email each time a comment is posted to this page, including yours. A link to turn this option off will be included with each email.

Internet adresses will be converted automatically. You can use the following notation to specify anchor text for a link: [url=http://example.com/]example text[/url].