Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Any help appreciated here.
I am writing a quick script to run through a list of webservers and
return the version they are running (for legitimate purposes I might

HTTP sessions are handled fine by the code, but I have indifferent
results from HTTPS, most commonly failing with the following error:

C:\tools\scripts>perl serversion.pl
Can't get -- 500 SSL negotiation failed:  at
 line 20.

I have other scripts working fine with HTTPS so I believe my OpenSSL /
Perl environment is set up fine.

Here is the short code I am using:

my $url = $ARGV[0];

# load LWP classes
  use LWP;

# create new instance of a browser
  my $browser = LWP::UserAgent->new;

# Check for errors
  my $response = $browser->get( $url );
  die "Can't get $url -- ", $response->status_line
   unless $response->is_success;

# status of request
  print $response->status_line,"\n";
  print $response->header(server),"\n";

Re: LWP and SSL

Quoted text here. Click to load it

That's the error I get, too, when I run your script and try to connect to .

However, when I try to browse to that page, I get "The page cannot be
displayed" - which suggests to me the problem is that the server is
unreachable, rather than there being any problem with the perl script.

ie, in my case at least, it seems that the "SSL negotiation failed" simply
because the server could not be found. Perhaps you need to check that the
server you're querying is up and running.


Re: LWP and SSL

Sisyphus wrote:

Quoted text here. Click to load it is a private IP range, so unless you are on a 192.168.*
network yourself and such a server exists, you're unlikely to be able
to connect to it.

Assuming that there is, in fact, an SSL enabled instance listening on
the relevant port, it is possible that your OpenSSL installation hasn't
been configured to accept the CA that you are using. Check out


It refers to stunnel, but the principle is the same. You could try

openssl s_client -connect

to see what happens.


Re: LWP and SSL

Sorry guys the actual IP address is a dummy one to protect the
I solved half my problem by not checking for errors but the error still
occures on some sites.
I will try the suggestion of checking it directly with OpenSSL, but I
now have a theory that the server in question (a clients) is not
actualy  a web server but might be hosting an SSL vpn.


Site Timeline