Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Creating SSL socket

by Khen1950fx (Canon)
on Oct 23, 2013 at 06:17 UTC ( #1059285=note: print w/replies, xml ) Need Help??

in reply to Creating SSL socket

For a first step, let's get your test client up and running:
#!/usr/bin/perl -w BEGIN { $ENV{'AUTOMATED_TESTING'} = 1; use strict; use warnings; use CPAN; CPAN::Shell->install(qw( Socket::GetAddrInfo Socket6 LWP::Protocol::https IO::Socket::SSL IO::Socket::INET6) ); } use strict; use IO::Socket::SSL qw(debug3); my $socket = IO::Socket::SSL->new( PeerAddr => '', PeerPort => 443, SSL_verify_mode => 0x00, ) or die "failed to connect: $SSL_ERROR"; print "OK: Connected\n"; $socket->autoflush; $socket->close( SSL_no_shutdown => 1, SSL_ctx_free => 1, ) or die "not ok: $SSL_ERROR"; print "OK: Closed\n";

Replies are listed 'Best First'.
Re^2: Creating SSL socket
by jdudleyh (Acolyte) on Oct 23, 2013 at 16:03 UTC

    Thanks Khen1950fx

    Apparently LWP::Protocol::HTTPS has not been installed on my system, and unfortunately it failed the install tests

    Running make test C:\strawberry\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib\lib', 'blib\arch')" t/*.t t/apache.t .. 1/4 # Failed test at t/apache.t line 15. # Failed test at t/apache.t line 16. # 'write failed: at C:/strawberry/perl/site/lib/LWP +/Protocol/ line 238. # ' # doesn't match '(?^:Apache Software Foundation)' # Failed test at t/apache.t line 23. # Looks like you failed 3 tests of 4. t/apache.t .. Dubious, test returned 3 (wstat 768, 0x300) Failed 3/4 subtests

    So now I am working to figure out how to get this module to install. There is no issue connecting to in my browsers.

    Using my internal https host, the script continues on to report:

    [...] DEBUG: .../IO/Socket/ Net::SSLeay::connect -> -1 DEBUG: .../IO/Socket/ fatal SSL error: SSL connect attempt +failed with unknown error [...]

    However if I change the host to (443):

    DEBUG: .../IO/Socket/ new ctx 60344912 OK: Connected DEBUG: .../IO/Socket/ free ctx 60344912 open=60344912 DEBUG: .../IO/Socket/ OK free ctx 60344912 not ok: at [ the $socket->close line ]

    There's one other important detail that I left out. The server that I'm connecting to is a load balancer. I don't think this should matter as it is supposed transparently forward the requests/responses.

    I'm going continue to explore testing against a known, working, external web service to determine if our internal web service/load balancer are breaking the script.

      Was a solution ever fond to the LWP::Protocol::HTTPS make test? I am having the same issue.

        Was a solution ever fond to the LWP::Protocol::HTTPS make test? I am having the same issue.

        Its simple, switch networks (whatever firewall/loadbalancer/proxy/network you're using isn't cooperating -- or you forgot to pay bill or your credentials expired )

        or skip the test, or force the install, or both :) cpan -f -i -T Module ; gets the module to install but you still may have same network problem

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059285]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2018-05-28 03:43 GMT
Find Nodes?
    Voting Booth?