@@ -329,6 +329,13 @@ zend_module_entry curl_module_entry = {
329
329
ZEND_GET_MODULE (curl )
330
330
#endif
331
331
332
+ /* {{{ PHP_INI_BEGIN */
333
+ PHP_INI_BEGIN ()
334
+ PHP_INI_ENTRY ("curl.cainfo" , "" , PHP_INI_SYSTEM , NULL )
335
+ PHP_INI_END ()
336
+ /* }}} */
337
+
338
+ /* }}} */
332
339
/* {{{ PHP_MINFO_FUNCTION
333
340
*/
334
341
PHP_MINFO_FUNCTION (curl )
@@ -456,6 +463,8 @@ PHP_MINIT_FUNCTION(curl)
456
463
le_curl = zend_register_list_destructors_ex (_php_curl_close , NULL , "curl" , module_number );
457
464
le_curl_multi_handle = zend_register_list_destructors_ex (_php_curl_multi_close , NULL , "curl_multi" , module_number );
458
465
466
+ REGISTER_INI_ENTRIES ();
467
+
459
468
/* See http://curl.haxx.se/lxr/source/docs/libcurl/symbols-in-versions
460
469
or curl src/docs/libcurl/symbols-in-versions for a (almost) complete list
461
470
of options and which version they were introduced */
@@ -882,6 +891,7 @@ PHP_MSHUTDOWN_FUNCTION(curl)
882
891
php_curl_openssl_tsl = NULL ;
883
892
}
884
893
#endif
894
+ UNREGISTER_INI_ENTRIES ();
885
895
return SUCCESS ;
886
896
}
887
897
/* }}} */
@@ -1430,6 +1440,7 @@ PHP_FUNCTION(curl_init)
1430
1440
zval * clone ;
1431
1441
char * url = NULL ;
1432
1442
int url_len = 0 ;
1443
+ char * cainfo ;
1433
1444
1434
1445
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "|s" , & url , & url_len ) == FAILURE ) {
1435
1446
return ;
@@ -1468,6 +1479,12 @@ PHP_FUNCTION(curl_init)
1468
1479
curl_easy_setopt (ch -> cp , CURLOPT_DNS_USE_GLOBAL_CACHE , 1 );
1469
1480
curl_easy_setopt (ch -> cp , CURLOPT_DNS_CACHE_TIMEOUT , 120 );
1470
1481
curl_easy_setopt (ch -> cp , CURLOPT_MAXREDIRS , 20 ); /* prevent infinite redirects */
1482
+
1483
+ cainfo = INI_STR ("curl.cainfo" );
1484
+ if (cainfo && strlen (cainfo ) > 0 ) {
1485
+ curl_easy_setopt (ch -> cp , CURLOPT_CAINFO , cainfo );
1486
+ }
1487
+
1471
1488
#if defined(ZTS )
1472
1489
curl_easy_setopt (ch -> cp , CURLOPT_NOSIGNAL , 1 );
1473
1490
#endif
0 commit comments