From 51d027cf79429e7cd5d6ec8731f8e913b78ee49f Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 2 Jan 2013 15:08:09 -0500
Subject: [PATCH] Added option to disable SSL verification in OAI harvesting.

---
 harvest/oai.ini                            | 4 ++++
 module/VuFind/src/VuFind/Harvester/OAI.php | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/harvest/oai.ini b/harvest/oai.ini
index e71fcb56f90..da519756eb8 100644
--- a/harvest/oai.ini
+++ b/harvest/oai.ini
@@ -16,6 +16,7 @@
 ; dateGranularity = auto
 ; harvestedIdLog = harvest.log
 ; verbose = false
+; sslverifypeer = true
 ;
 ; The section_name may be passed to harvest_oai.php as a parameter to harvest only
 ; records from that source.  This is also the directory name that records will be
@@ -74,6 +75,9 @@
 ; verbose may be set to true in order to display more detailed output while
 ; harvesting; this may be useful for troubleshooting purposes, but it defaults to
 ; false.
+;
+; sslverifypeer may be set to false to disable SSL certificate checking; it defaults
+; to true, and changing the setting is not recommended.
 
 ; SAMPLE CONFIGURATION FOR OPEN JOURNAL SYSTEMS
 ;[OJS]
diff --git a/module/VuFind/src/VuFind/Harvester/OAI.php b/module/VuFind/src/VuFind/Harvester/OAI.php
index 2564a0c8d01..0fa942941ea 100644
--- a/module/VuFind/src/VuFind/Harvester/OAI.php
+++ b/module/VuFind/src/VuFind/Harvester/OAI.php
@@ -194,6 +194,11 @@ class OAI
         // Store client:
         $this->client = $client;
 
+        // Disable SSL verification if requested:
+        if (isset($settings['sslverifypeer']) && !$settings['sslverifypeer']) {
+            $this->client->setOptions(array('sslverifypeer' => false));
+        }
+
         // Don't time out during harvest!!
         set_time_limit(0);
 
-- 
GitLab