2

I am very new to perl. I am using it at work, and I got the following error yesterday, for a script that was running just fine on the previous day.

Error GETing https://www.someurl.com:443: Protocol scheme 'https' is not supported (LWP::Protocol::https not installed)

(Note: www.someurl.com is not a real url. I don't want to post the actual url in case it might be an issue.)

I am using the WWW::Mechanize for fetching a webpage and I get the error for the line

my $res = $mech->get( $url );

The actual value of $url is not even https it is http://www.someurl.com

I referred to the some questions on SO. Like this one Random error with WWW::Mechanize: Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) which mentions which modules to check for and confirmed that they are all installed. Also checked Random error with WWW::Mechanize: Protocol scheme 'https' is not supported (LWP::Protocol::https not installed) but I don't think it applies to me as I'm not splitting a process into threads.

Can someone please help me out? I will be happy to post any other information required.

Edit: I am using RHEL7 server, with Perl 5.16.3. I have the WWW::Mechanize, openSSL, IO::Socket::SSL, LWP::Protocol:https, Net::SSLeay, Crypt::SSLeay installed.

We didn't change any configuration or code between the last time the script was working and the time it started failing.

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Amruta
  • 1,295
  • 1
  • 13
  • 24
  • *"The actual value of $url is not even https"* - the server likely redirects from http to https, so the code ultimately needs to access a https URL. *"Can someone please help me out?"* - I don't understand how the questions you referred to don't help. For some reason the LWP:::Protocol::https module is missing in your installation. No details are known why, in fact no details are known at all about your system, your installation of Perl and which modules are installed. – Steffen Ullrich Jun 02 '22 at 04:35
  • @SteffenUllrich I have updated the question with some more details. I have checked to make sure all the correct modules are installed(referred to the first question linked). – Amruta Jun 02 '22 at 04:55
  • 1
    What is the output of `perl -MLWP::Protocol::https -e 'print $LWP::Protocol::https::VERSION,"\n"'` ? – Steffen Ullrich Jun 02 '22 at 04:57
  • `Can't locate LWP/Protocol/https.pm in @INC (@INC contains: /apps/DBDOracle/usr/local/lib64/perl5/ /home/Shared/uat/lib/Perl_Lib /home/perl/RH4-32/uat/lib /home/perl/RH4-32/uat/lib/site_perl /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .). BEGIN failed--compilation aborted.` – Amruta Jun 02 '22 at 05:28
  • 1
    This clearly means that LWP::Protocol::https is not installed, contrary to what you've stated in your question – Steffen Ullrich Jun 02 '22 at 05:37
  • I had only checked using `instmodsh`, which listed the correct modules. I showed this output to a teamamte who had the idea to check our env file. Turns out someone had appended to our perl path while testing and didn't change it back. – Amruta Jun 02 '22 at 06:08

1 Answers1

3

Install LWP::Protocol::https. This used to be bundled as part of LWP, but was then moved to its own distribution so the complexity of linking to the libraries that HTTPS needs doesn't burden all of LWP.

% cpan LWP LWP::Protocol::https
brian d foy
  • 129,424
  • 31
  • 207
  • 592