changeset 25281:35115cc6183b stable

allow users to set path to CA certificates for cURL * url-transfer.cc (curl_transfer::curl_transfer): Check for CURLOPT_CAINFO and CURLOPT_CAPATH environment variables. If set, use them to set the corresponding options for the cURL library.
author John W. Eaton <jwe@octave.org>
date Wed, 18 Apr 2018 15:18:47 -0400
parents 1eff55e9debe
children ed0c2683a316 78fb24bdd8bb
files liboctave/util/url-transfer.cc
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/url-transfer.cc	Wed Apr 18 10:37:56 2018 -0700
+++ b/liboctave/util/url-transfer.cc	Wed Apr 18 15:18:47 2018 -0400
@@ -36,6 +36,7 @@
 #include "dir-ops.h"
 #include "file-ops.h"
 #include "file-stat.h"
+#include "oct-env.h"
 #include "unwind-prot.h"
 #include "url-transfer.h"
 
@@ -323,6 +324,14 @@
 
       init ("", "", std::cin, os);
 
+      std::string cainfo = sys::env::getenv ("CURLOPT_CAINFO");
+      if (! cainfo.empty ())
+        SETOPT (CURLOPT_CAINFO, cainfo.c_str ());
+
+      std::string capath = sys::env::getenv ("CURLOPT_CAPATH");
+      if (! capath.empty ())
+        SETOPT (CURLOPT_CAPATH, capath.c_str ());
+
       SETOPT (CURLOPT_NOBODY, 0);
 
       // Restore the default HTTP request method to GET after setting