[mapserver-commits] r9016 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Fri May 15 07:34:38 EDT 2009


Author: dmorissette
Date: 2009-05-15 07:34:38 -0400 (Fri, 15 May 2009)
New Revision: 9016

Modified:
   trunk/mapserver/maphttp.c
Log:
Add support for CURL_CA_BUNDLE env. var. (#3007)

Modified: trunk/mapserver/maphttp.c
===================================================================
--- trunk/mapserver/maphttp.c	2009-05-14 19:54:30 UTC (rev 9015)
+++ trunk/mapserver/maphttp.c	2009-05-15 11:34:38 UTC (rev 9016)
@@ -267,6 +267,7 @@
     CURLM   *multi_handle;
     CURLMsg *curl_msg;
     char     debug = MS_FALSE;
+    const char *pszCurlCABundle = NULL;
 
     if (numRequests == 0)
         return MS_SUCCESS;  /* Nothing to do */
@@ -291,9 +292,17 @@
     if (nTimeout <= 0)
         nTimeout = 30;
 
+    /* Check if we've got a CURL_CA_BUNDLE env. var.
+     * If set then the value is the full path to the ca-bundle.crt file
+     * e.g. CURL_CA_BUNDLE=/usr/local/share/curl/curl-ca-bundle.crt
+     */
+    pszCurlCABundle = getenv("CURL_CA_BUNDLE");
+
     if (debug)
     {
         msDebug("HTTP: Starting to prepare HTTP requests.\n");
+        if (pszCurlCABundle)
+            msDebug("Using CURL_CA_BUNDLE=%s\n", pszCurlCABundle);
     }
 
     /* Alloc a curl-multi handle, and add a curl-easy handle to it for each
@@ -394,7 +403,11 @@
 
         /* Set timeout.*/
         curl_easy_setopt(http_handle, CURLOPT_TIMEOUT, nTimeout );
-        
+
+        /* Pass CURL_CA_BUNDLE if set */
+        if (pszCurlCABundle)
+            curl_easy_setopt(http_handle, CURLOPT_CAINFO, pszCurlCABundle );
+
         /* Set proxying settings */
         if (pasReqInfo[i].pszProxyAddress != NULL
             && strlen(pasReqInfo[i].pszProxyAddress) > 0)



More information about the mapserver-commits mailing list