pajoye          Sun Jan 25 17:12:24 2009 UTC

  Modified files:              
    /php-src/ext/curl   interface.c 
  Log:
  - nicer features list
  
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.142&r2=1.143&diff_format=u
Index: php-src/ext/curl/interface.c
diff -u php-src/ext/curl/interface.c:1.142 php-src/ext/curl/interface.c:1.143
--- php-src/ext/curl/interface.c:1.142  Sun Jan 25 16:27:25 2009
+++ php-src/ext/curl/interface.c        Sun Jan 25 17:12:22 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: interface.c,v 1.142 2009/01/25 16:27:25 pajoye Exp $ */
+/* $Id: interface.c,v 1.143 2009/01/25 17:12:22 pajoye Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -330,77 +330,65 @@
        sprintf(str, "%d", d->age);
        php_info_print_table_row(2, "Age", str);
 
-#ifdef CURL_VERSION_IPV6
-       if (d->features & CURL_VERSION_IPV6) {
-               n = sprintf(str, "%s", "IPv6-enabled, ");
-       }
-#endif
-
-#ifdef CURL_VERSION_KERBEROS4
-       if (d->features & CURL_VERSION_KERBEROS4) {
-                       n += sprintf(str + n, "%s", "kerberos auth is 
supported, ");
-       }
-#endif
+       /* To update on each new cURL release using src/main.c in cURL sources 
*/
+       if(d->features) {
+               struct feat {
+                       const char *name;
+                       int bitmask;
+               };
 
-#ifdef CURL_VERSION_SSL
-       if (d->features & CURL_VERSION_SSL) {
-                       n += sprintf(str + n, "%s", "SSL options are present, 
");
-       }
-#endif
+               unsigned int i;
 
-#ifdef CURL_VERSION_LIBZ
-       if (d->features & CURL_VERSION_LIBZ) {
-                       n += sprintf(str + n, "%s", "libz features are present, 
");
-       }
+               static const struct feat feats[] = {
+#if LIBCURL_VERSION_NUM > 0x070a06 /* 7.10.7 */
+                       {"AsynchDNS", CURL_VERSION_ASYNCHDNS},
 #endif
 
 #if LIBCURL_VERSION_NUM > 0x070a05 /* 7.10.6 */
-       if (d->features & CURL_VERSION_NTLM) {
-                       n += sprintf(str + n, "%s", "NTLM auth is supported, ");
-       }
-       if (d->features & CURL_VERSION_GSSNEGOTIATE) {
-                       n += sprintf(str + n, "%s", "Negotiate auth support, ");
-       }
-       if (d->features & CURL_VERSION_DEBUG) {
-                       n += sprintf(str + n, "%s", "built with debug 
capabilities, ");
-       }
+                       {"Debug", CURL_VERSION_DEBUG},
+                       {"GSS-Negotiate", CURL_VERSION_GSSNEGOTIATE},
 #endif
-
-#if LIBCURL_VERSION_NUM > 0x070a06 /* 7.10.7 */
-       if (d->features & CURL_VERSION_ASYNCHDNS) {
-                       n += sprintf(str + n, "%s", "asynchronous dns resolves, 
");
-       }
+#if LIBCURL_VERSION_NUM > 0x070b02 /* 7.12.0 */
+                       {"IDN", CURL_VERSION_IDN},
 #endif
-#if LIBCURL_VERSION_NUM > 0x070a07 /* 7.10.8 */
-       if (d->features & CURL_VERSION_SPNEGO) {
-                       n += sprintf(str + n, "%s", "SPNEGO auth, ");
-       }
+#ifdef CURL_VERSION_IPV6
+                       {"IPv6", CURL_VERSION_IPV6},
 #endif
 #if LIBCURL_VERSION_NUM > 0x070a09 /* 7.10.1 */
-       if (d->features & CURL_VERSION_LARGEFILE) {
-                       n += sprintf(str + n, "%s", "supports files bigger than 
2GB, ");
-       }
+                       {"Largefile", CURL_VERSION_LARGEFILE},
 #endif
-#if LIBCURL_VERSION_NUM > 0x070b02 /* 7.12.0 */
-       if (d->features & CURL_VERSION_IDN) {
-                       n += sprintf(str + n, "%s", "International Domain Names 
support, ");
-       }
+#if LIBCURL_VERSION_NUM > 0x070a05 /* 7.10.6 */
+                       {"NTLM", CURL_VERSION_NTLM},
+#endif
+#if LIBCURL_VERSION_NUM > 0x070a07 /* 7.10.8 */
+                       {"SPNEGO", CURL_VERSION_SPNEGO},
+#endif
+#ifdef CURL_VERSION_SSL
+                       {"SSL",  CURL_VERSION_SSL},
 #endif
 #if LIBCURL_VERSION_NUM > 0x070d01 /* 7.13.2 */
-       if (d->features & CURL_VERSION_SSPI) {
-                       n += sprintf(str + n, "%s", "SSPI is supported, ");
-       }
+                       {"SSPI",  CURL_VERSION_SSPI},
+#endif
+#ifdef CURL_VERSION_KERBEROS4
+                       {"krb4", CURL_VERSION_KERBEROS4},
+#endif
+#ifdef CURL_VERSION_LIBZ
+                       {"libz", CURL_VERSION_LIBZ},
 #endif
 #if LIBCURL_VERSION_NUM > 0x070f03 /* 7.15.4 */
-       if (d->features & CURL_VERSION_CONV) {                   
-                       n += sprintf(str + n, "%s", "character conversions are 
supported, ");
-       }
+                       {"CharConv", CURL_VERSION_CONV},
 #endif
+                       NULL, 0
+               };
 
-       if (n > 3) {
-               str[n - 2] = '\0';
+               php_info_print_table_row(1, "Features");
+               for(i=0; i<sizeof(feats)/sizeof(feats[0]); i++) {
+                       if (feats[i].name) {
+                               php_info_print_table_row(2, feats[i].name, 
d->features & feats[i].bitmask ? "Yes" : "No");
+                       }
+               }
        }
-       php_info_print_table_row(2, "Features", str);
+
        n = 0;
        p = (char **) d->protocols;
        while (*p != NULL) {



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

Reply via email to