http://qs1969.pair.com?node_id=1083931


in reply to LWP and HTTPS

$ wget https://www.kmcgov.in/KMCPortal/jsp/KMCDeathRecordSearch.jsp --2014-04-26 15:23:36-- https://www.kmcgov.in/KMCPortal/jsp/KMCDeathR +ecordSearch.jsp Resolving www.kmcgov.in (www.kmcgov.in)... 210.212.29.170 Connecting to www.kmcgov.in (www.kmcgov.in)|210.212.29.170|:443... con +nected. OpenSSL: error:140773E8:SSL routines:SSL23_GET_SERVER_HELLO:reason(100 +0) Unable to establish SSL connection. $ curl https://www.kmcgov.in/KMCPortal/jsp/KMCDeathRecordSearch.jsp curl: (35) error:140773E8:SSL routines:SSL23_GET_SERVER_HELLO:reason(1 +000)

I'd argue that either server's SSL setup is broken, or that you need a trust client certificate. Perl won't help you here.

Replies are listed 'Best First'.
Re^2: LWP and HTTPS
by Gangabass (Vicar) on Apr 26, 2014 at 13:30 UTC
    But why it's working in the browser? How I can tell LWP to ignore this error?
      Yet another broken SSL server which cannot do TLS1.0 or better. Browsers work around this kind of error by retrying with a downgraded SSL version.
      Recent versions of LWP (base of WWW::Mechanize) use IO::Socket::SSL/Net::SSLeay by default and you can simply enforce a specific SSL version like this:
      $mech->ssl_opts( SSL_version => 'SSLv3');
      I've tested it and it works with this broken server.
        Brilliant!!! Thank you! But I still don't understand why $ENV{ HTTPS_VERSION }= 3 is not work but  SSL_version => 'SSLv3' works...
Re^2: LWP and HTTPS
by Gangabass (Vicar) on Apr 26, 2014 at 13:44 UTC
    I tried $ENV{HTTPS_VERSION} = 3; because curl -3 $URL is working but my Perl code still return same error :-(

      If you want to set up the environment, either do so outside your script, or at least, before the SSL modules are loaded:

      BEGIN { $ENV{ HTTPS_VERSION }= 3; }; use WWW::Mechanize;
        This will not work because $ENV{ HTTPS_VERSION }= 3; is the default value :-(