pajoye                                   Fri, 01 Apr 2011 17:10:52 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=309880

Log:
- [doc] add ini option to set the default cainfo file, in case none was set at 
compile time

Changed paths:
    U   php/php-src/trunk/ext/curl/interface.c

Modified: php/php-src/trunk/ext/curl/interface.c
===================================================================
--- php/php-src/trunk/ext/curl/interface.c      2011-04-01 16:00:11 UTC (rev 
309879)
+++ php/php-src/trunk/ext/curl/interface.c      2011-04-01 17:10:52 UTC (rev 
309880)
@@ -329,6 +329,13 @@
 ZEND_GET_MODULE (curl)
 #endif

+/* {{{ PHP_INI_BEGIN */
+PHP_INI_BEGIN()
+       PHP_INI_ENTRY("curl.cainfo", "", PHP_INI_SYSTEM, NULL)
+PHP_INI_END()
+/* }}} */
+
+/* }}} */
 /* {{{ PHP_MINFO_FUNCTION
  */
 PHP_MINFO_FUNCTION(curl)
@@ -456,6 +463,8 @@
        le_curl = zend_register_list_destructors_ex(_php_curl_close, NULL, 
"curl", module_number);
        le_curl_multi_handle = 
zend_register_list_destructors_ex(_php_curl_multi_close, NULL, "curl_multi", 
module_number);

+       REGISTER_INI_ENTRIES();
+
        /* See http://curl.haxx.se/lxr/source/docs/libcurl/symbols-in-versions
           or curl src/docs/libcurl/symbols-in-versions for a (almost) complete 
list
           of options and which version they were introduced */
@@ -882,6 +891,7 @@
                php_curl_openssl_tsl = NULL;
        }
 #endif
+       UNREGISTER_INI_ENTRIES();
        return SUCCESS;
 }
 /* }}} */
@@ -1430,6 +1440,7 @@
        zval            *clone;
        char            *url = NULL;
        int             url_len = 0;
+       char *cainfo;

        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &url, 
&url_len) == FAILURE) {
                return;
@@ -1468,6 +1479,12 @@
        curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1);
        curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120);
        curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite 
redirects */
+
+       cainfo = INI_STR("curl.cainfo");
+       if (cainfo && strlen(cainfo) > 0) {
+               curl_easy_setopt(ch->cp, CURLOPT_CAINFO, cainfo);
+       }
+
 #if defined(ZTS)
        curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1);
 #endif

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to