Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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 => 'www.example.com', 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";


Comment on Re: Creating SSL socket
Download Code
Re^2: Creating SSL socket
by jdudleyh (Novice) 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/http.pm 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 https://apache.org/ in my browsers.

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

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

    However if I change the host to apache.org (443):

    DEBUG: .../IO/Socket/SSL.pm:1784: new ctx 60344912 OK: Connected DEBUG: .../IO/Socket/SSL.pm:1821: free ctx 60344912 open=60344912 DEBUG: .../IO/Socket/SSL.pm:1829: 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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059285]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-04-18 12:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (466 votes), past polls