]> granicus.if.org Git - php/commitdiff
Unregister appropriate curl wrappers
authorPierrick Charron <pierrick@php.net>
Wed, 14 Dec 2011 04:02:56 +0000 (04:02 +0000)
committerPierrick Charron <pierrick@php.net>
Wed, 14 Dec 2011 04:02:56 +0000 (04:02 +0000)
ext/curl/interface.c

index 7c3c5a79752f1da4f0b7b5afe54519f793b24f5e..bf6ffd8e90fd974adc927258bb01fd0cc401742a 100644 (file)
@@ -1165,10 +1165,18 @@ PHP_MINIT_FUNCTION(curl)
 PHP_MSHUTDOWN_FUNCTION(curl)
 {
 #ifdef PHP_CURL_URL_WRAPPERS
-       php_unregister_url_stream_wrapper("http" TSRMLS_CC);
-       php_unregister_url_stream_wrapper("https" TSRMLS_CC);
-       php_unregister_url_stream_wrapper("ftp" TSRMLS_CC);
-       php_unregister_url_stream_wrapper("ldap" TSRMLS_CC);
+       {
+               curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
+               char **p = (char **)info->protocols;
+
+               while (*p != NULL) {
+                       /* Do not enable cURL "file" protocol and make sure cURL is always used when --with-curlwrappers is enabled */
+                       if (strncasecmp(*p, "file", sizeof("file")-1) != 0) {
+                               php_unregister_url_stream_wrapper(*p TSRMLS_CC);
+                       }
+                       (void) *p++;
+               }
+       }
 #endif
        curl_global_cleanup();
 #ifdef PHP_CURL_NEED_OPENSSL_TSL