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

Greetings All

I'm trying to load a page which is using HTTPS protocol and it is giving me an error

SSL upgrade failed: SSL connect attempt failed because of handshake problems

I have installed LWP::PROTOCOL::https. This is my code

use strict; use warnings; use WWW::Scripter; use Net::SSL; my $w= WWW::Scripter->new( cookie_jar => { autosave => 1} ); $w->use_plugin('JavaScript'); # packaged separately $ENV{HTTPS_VERSION} = '3'; $w->get('https://abc.xyz.com'); my $home_title=$w->title(); print $home_title;

Please suggest

Thanks in advance!

Replies are listed 'Best First'.
Re: SSL Upgrade failed
by Corion (Patriarch) on Jul 25, 2017 at 13:07 UTC

    Maybe your client or your server doesn't support the TLS version you request, or both of them can't find a common version to talk to each other.

    Maybe consider using analyze-ssl.pl to find out what your server speaks. That way, you can maybe see where the handshake goes wrong.

      Hi

      Thanks for reply! but still in getting the below error-

      DEBUG: .../IO/Socket/SSL.pm:2805: new ctx 49345824 DEBUG: .../IO/Socket/SSL.pm:659: socket not yet connected DEBUG: .../IO/Socket/SSL.pm:661: socket connected DEBUG: .../IO/Socket/SSL.pm:684: ssl handshake not started DEBUG: .../IO/Socket/SSL.pm:726: not using SNI because openssl is too +old DEBUG: .../IO/Socket/SSL.pm:773: set socket to non-blocking to enforce + timeout=180 DEBUG: .../IO/Socket/SSL.pm:786: call Net::SSLeay::connect DEBUG: .../IO/Socket/SSL.pm:789: done Net::SSLeay::connect -> -1 DEBUG: .../IO/Socket/SSL.pm:799: ssl handshake in progress DEBUG: .../IO/Socket/SSL.pm:809: waiting for fd to become ready: SSL w +ants a read first DEBUG: .../IO/Socket/SSL.pm:829: socket ready, retrying connect DEBUG: .../IO/Socket/SSL.pm:786: call Net::SSLeay::connect DEBUG: .../IO/Socket/SSL.pm:789: done Net::SSLeay::connect -> 0 DEBUG: .../IO/Socket/SSL.pm:837: connection failed - connect returned +0 DEBUG: .../IO/Socket/SSL.pm:838: local error: SSL connect attempt fail +ed because of handshake problems DEBUG: ...erl5/Net/HTTPS.pm:67: ignoring less severe local error 'IO:: +Socket::IP configuration failed', keep 'SSL connect attempt failed be +cause of handshake problems' DEBUG: .../IO/Socket/SSL.pm:2827: free ctx 49345824 open= DEBUG: .../IO/Socket/SSL.pm:2838: OK free ctx 49345824 Can't connect to ... SSL connect attempt failed because of handshake problems at /home/an97 +54/perl5/lib/perl5/LWP/Protocol/http.pm line 48.
      I have checked,URL is using SSL_VERSION TLSv1_2 , I have tried that also by putting this version but it is showing this error
      DEBUG: .../IO/Socket/SSL.pm:625: global error: SSL Version TLSv1_2 not + supported Can't connect to ...

      please help

        >... not using SNI because openssl is too old
        >... SSL Version TLSv1_2 not supported

        These two messages indicate that you are using a very old version of OpenSSL, i.e. OpenSSL 0.9.8 or even worse. There is no support for TLS 1.2 in this old version and it is also missing support for ECDHE ciphers. Also there is no support for SNI with this version of OpenSSL in IO::Socket::SSL.
        It is very likely that your (unknown) server either requires SNI and/or modern ciphers and/or modern TLS protocol versions. And since this is not supported with your old OpenSSL version the handshake fails.

Re: SSL Upgrade failed
by thanos1983 (Parson) on Jul 25, 2017 at 13:18 UTC

    Hello trahulprajapati,

    I think by accident you created a duplicated question SSL Negotiation failed in WWW::Scripter.

    Try to avoid in future posts, it produces confusion (thanks for understanding).

    Seeking for Perl wisdom...on the process of learning...not there...yet!

      Hi

      Yes,by mistake i have created that...

      Sure, I will take care it from next time

      thanks