in reply to WWW::Mechanize cannot connect to HTTPS site

The classic thing that trips me up when doing this is that I forget to install LWP::Protocol::https. I think the result of $mech->get should return 599 then. For a somewhat verbose output, dump the result of ->get:

use Data::Dumper; print Dumper $mech->get('https://www.cpan.org');

If this fails with a non-599 error, consider cross-checking with wget or curl. If these two cannot connect to the outside world, then outgoing https connections are likely blocked by your network somewhere. If wget or curl work, this means that there is likely an environment variable that tells the two to use a proxy to connect to the outside world. This would likely be a SOCKS proxy, since WWW::Mechanize automatically picks up other proxies from the environment variables HTTP_PROXY or HTTPS_PROXY.

Replies are listed 'Best First'.
Re^2: WWW::Mechanize cannot connect to HTTPS site
by Marshall (Canon) on May 29, 2024 at 09:36 UTC
    I've emailed the user with your code. Note that the browsers work and can access the URL. I don't why Chrome would be able to and a Perl script would not. I will also ask the user to run the test script in a command window with Admin privileges. Also this is in a home environment, not corporate.

    Update: I did some testing. wget doesn't come with Windows 10, but curl does. curl https://www.cpan.org works on my machine and I suggested this test to the user.