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

Hi Perl Monks,

I have a perlscript which is connecting to urls and downloading the contents of that.The script we are running in unix environment connecting through the proxy server.For http urls it is running fine, but when i gave https url its throwing error like "500 cannot connect to url". I am using WWW::Mechanize module and LWP 6.04v in the script. Can anybody suggest the solution for this? and what are the possible ways to get 500 connection issue?

Replies are listed 'Best First'.
Re: Unable to connect to HTTPS servers
by poj (Abbot) on Mar 23, 2017 at 07:25 UTC

    6.04 is 5 years old, current version is 6.24 2017-03-14. Version 6.06 2014-04-16 has this in changes

    - correct behavior for https_proxy,

    so consider upgrading.

      Could you please tell me how to update Perl in unix which was there in a particular directory?

        In many cases it's generally better to let the OS package management take care of keeping the system perl up to date. An alternative is to simply build your own perl elsewhere in the system. README. See also perlbrew.

        you dont need to upgrade Perl to install a newer version of LWP
Re: Unable to connect to HTTPS servers
by Corion (Patriarch) on Mar 23, 2017 at 08:17 UTC

    If there is no HTTPS proxy in play, maybe it is an SSL certificate issue. Print the complete response headers to maybe find out more. Also switch IO::Socket::SSL debugging on:

    $IO::Socket::SSL::DEBUG = 3;

    If you've determined that IO::Socket::SSL doesn't want to talk to the remote side, see p5-ssl-tools, which contain tools that will give you more diagnostics as to what part of the SSL connection fails.

Re: Unable to connect to HTTPS servers
by noxxi (Pilgrim) on Mar 23, 2017 at 12:58 UTC
    Proxy support for https in 6.04 is broken. You either need to upgrade to at least 6.06 or work around the problem by using Net::SSLGlue::LWP or LWP::protocol::https or enforcing the use of Crypt::SSLeay over the default IO::Socket::SSL.