1

I want to check whether an https site is launching or not. How can i find this using Perl LWP module to get the content of an https site. I tried LWP::UserAgent module, to get the redirected URL

$ua = LWP::UserAgent->new;
$ua->agent("$0/0.1 " . $ua->agent);
$req = HTTP::Request->new(HEAD => 'http://some.com');
$req->header('Accept' => 'text/html');
$res = $ua->request($req);
$res->is_success => This results in false. giving the below error.

500 SSL negotiation failed.

Note: there is redirection envolved in this.. Where the final url is an https and not http.

Can anyone guide me how to fix this.

Rahul
  • 1,569
  • 4
  • 16
  • 17

1 Answers1

2

Did you read the README.SSL file that comes with LWP? It tells you to install LWP::Protocol::https.

As of libwww-perl v6.02 you need to install the LWP::Protocol::https module from its own separate distribution to enable support for https://... URLs for LWP::UserAgent.

This makes it possible for that distribution to state the required dependencies as non-optional. See https://rt.cpan.org/Ticket/Display.html?id=66838 for further discussion why we ended up with this solution.

Update: This answer seems relevant. You might need to upgrade a lot of your software.

Community
  • 1
  • 1
Dave Cross
  • 68,119
  • 3
  • 51
  • 97
  • LWP::Protocol::https package is already installed and present under lib\LWP\Protocol. but still i am getting 500 SSL negotiation failed error. I am actually new to perl, Please let me know if i need to do something more. – Rahul Mar 13 '17 at 11:31