- libevent diagnostics
authorMichael Wallner <mike@php.net>
Wed, 16 May 2007 19:26:26 +0000 (19:26 +0000)
committerMichael Wallner <mike@php.net>
Wed, 16 May 2007 19:26:26 +0000 (19:26 +0000)
config9.m4
http.c
http_api.c
php_http_api.h
tests/HttpRequestPool_007.phpt

index e0147dd..bebb5a7 100644 (file)
@@ -288,6 +288,19 @@ dnl ----
                                AC_MSG_WARN([continuing without libevent support])
                        else
                                AC_MSG_RESULT([found in $EVENT_DIR])
                                AC_MSG_WARN([continuing without libevent support])
                        else
                                AC_MSG_RESULT([found in $EVENT_DIR])
+                               
+                               AC_MSG_CHECKING([for libevent version, roughly])
+                               EVENT_VER="1.1b or lower"
+                               if test -f "$EVENT_DIR/include/evhttp.h" && test -f "$EVENT_DIR/include/evdns.h"; then
+                                       if test -f "$EVENT_DIR/include/evrpc.h"; then
+                                               EVENT_VER="1.4 or greater"
+                                       else
+                                               EVENT_VER="1.2 or greater"
+                                       fi
+                               fi
+                               AC_DEFINE_UNQUOTED([HTTP_EVENT_VERSION], ["$EVENT_VER"], [ ])
+                               AC_MSG_RESULT([$EVENT_VER])
+                               
                                AC_MSG_CHECKING([for libcurl version >= 7.16.0])
                                AC_MSG_RESULT([$CURL_VERSION])
                                if test `echo $CURL_VERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print $1*10000 + $2*100 + $3}'` -lt 71600; then
                                AC_MSG_CHECKING([for libcurl version >= 7.16.0])
                                AC_MSG_RESULT([$CURL_VERSION])
                                if test `echo $CURL_VERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print $1*10000 + $2*100 + $3}'` -lt 71600; then
diff --git a/http.c b/http.c
index f6b2118..923748d 100644 (file)
--- a/http.c
+++ b/http.c
@@ -454,6 +454,11 @@ PHP_MINFO_FUNCTION(http)
 #else
                php_info_print_table_row(2, "libcurl", "disabled", "disabled");
 #endif
 #else
                php_info_print_table_row(2, "libcurl", "disabled", "disabled");
 #endif
+#ifdef HTTP_HAVE_EVENT
+               php_info_print_table_row(3, "libevent", HTTP_EVENT_VERSION, event_get_version());
+#else
+               php_info_print_table_row(3, "libevent", "disabled", "disabled");
+#endif
 #ifdef HTTP_HAVE_ZLIB
                php_info_print_table_row(3, "libz", ZLIB_VERSION, zlibVersion());
 #else
 #ifdef HTTP_HAVE_ZLIB
                php_info_print_table_row(3, "libz", ZLIB_VERSION, zlibVersion());
 #else
index 138b08e..61de3e8 100644 (file)
@@ -32,6 +32,7 @@ PHP_MINIT_FUNCTION(http_support)
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_MAGICMIME", HTTP_SUPPORT_MAGICMIME);
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_ENCODINGS", HTTP_SUPPORT_ENCODINGS);
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_SSLREQUESTS", HTTP_SUPPORT_SSLREQUESTS);
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_MAGICMIME", HTTP_SUPPORT_MAGICMIME);
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_ENCODINGS", HTTP_SUPPORT_ENCODINGS);
        HTTP_LONG_CONSTANT("HTTP_SUPPORT_SSLREQUESTS", HTTP_SUPPORT_SSLREQUESTS);
+       HTTP_LONG_CONSTANT("HTTP_SUPPORT_EVENTS", HTTP_SUPPORT_EVENTS);
        
        HTTP_LONG_CONSTANT("HTTP_PARAMS_ALLOW_COMMA", HTTP_PARAMS_ALLOW_COMMA);
        HTTP_LONG_CONSTANT("HTTP_PARAMS_ALLOW_FAILURE", HTTP_PARAMS_ALLOW_FAILURE);
        
        HTTP_LONG_CONSTANT("HTTP_PARAMS_ALLOW_COMMA", HTTP_PARAMS_ALLOW_COMMA);
        HTTP_LONG_CONSTANT("HTTP_PARAMS_ALLOW_FAILURE", HTTP_PARAMS_ALLOW_FAILURE);
@@ -50,6 +51,9 @@ PHP_HTTP_API long _http_support(long feature)
 #      ifdef HTTP_HAVE_SSL
        support |= HTTP_SUPPORT_SSLREQUESTS;
 #      endif
 #      ifdef HTTP_HAVE_SSL
        support |= HTTP_SUPPORT_SSLREQUESTS;
 #      endif
+#      ifdef HTTP_HAVE_EVENT
+       support |= HTTP_SUPPORT_EVENTS;
+#      endif
 #endif
 #ifdef HTTP_HAVE_MAGIC
        support |= HTTP_SUPPORT_MAGICMIME;
 #endif
 #ifdef HTTP_HAVE_MAGIC
        support |= HTTP_SUPPORT_MAGICMIME;
index 2de5abb..b8af494 100644 (file)
@@ -21,6 +21,7 @@
 #define HTTP_SUPPORT_ENCODINGS         0x08L
 #define HTTP_SUPPORT_SSLREQUESTS       0x20L
 #define HTTP_SUPPORT_PERSISTENCE       0x40L
 #define HTTP_SUPPORT_ENCODINGS         0x08L
 #define HTTP_SUPPORT_SSLREQUESTS       0x20L
 #define HTTP_SUPPORT_PERSISTENCE       0x40L
+#define HTTP_SUPPORT_EVENTS                    0x80L
 
 #define HTTP_PARAMS_ALLOW_COMMA                0x01
 #define HTTP_PARAMS_ALLOW_FAILURE      0x02
 
 #define HTTP_PARAMS_ALLOW_COMMA                0x01
 #define HTTP_PARAMS_ALLOW_FAILURE      0x02
index 2105d49..8e97d40 100644 (file)
@@ -5,8 +5,7 @@ HttpRequestPool chain with libevent
 include 'skip.inc';
 checkcls('HttpRequest');
 checkcls('HttpRequestPool');
 include 'skip.inc';
 checkcls('HttpRequest');
 checkcls('HttpRequestPool');
-$pool = new RequestPool;
-skipif(!@$pool->enableEvents(), "need libevent support");
+skipif(!http_support(HTTP_SUPPORT_EVENTS), "need libevent support");
 ?>
 --FILE--
 <?php
 ?>
 --FILE--
 <?php