ignore ssl certificate errors master
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 9 Sep 2021 09:13:45 +0000 (11:13 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 9 Sep 2021 09:13:45 +0000 (11:13 +0200)
Aleph.pm
Scraper.pm

index 5c88d2e..5bbe8ba 100644 (file)
--- a/Aleph.pm
+++ b/Aleph.pm
@@ -71,7 +71,7 @@ sub search {
 
        $session_id ||= int rand(1000000000);
        # FIXME allocate session just once
-       my $url = 'http://katalog.nsk.hr/F?RN=' . $session_id;
+       my $url = 'https://katalog.nsk.hr/F?RN=' . $session_id;
        # fake JavaScript code on page which creates random session
 
 diag "get $url";
index 692a4c6..d3e1c84 100644 (file)
@@ -3,15 +3,22 @@ package Scraper;
 use warnings;
 use strict;
 
+use IO::Socket::SSL qw();
 use WWW::Mechanize;
 
+
 sub new {
     my ( $class, $database ) = @_;
 
        $database ||= $class;
 
     my $self = {
-               mech => WWW::Mechanize->new(),
+               mech => WWW::Mechanize->new(
+                       ssl_opts => {
+                           SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
+                           verify_hostname => 0, # this key is likely going to be removed in future LWP >6.04
+                       }
+               ),
                database => $database,
        };
     bless $self, $class;