- 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 e0147dda2ab0c8534b90b0d8b1652ff33ba1ffb4..bebb5a70c22836640bc2f526cb32bd9ba9b9748e 100644 (file)
@@ -288,6 +288,19 @@ dnl ----
                                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
diff --git a/http.c b/http.c
index f6b21189a48136400cdedb1e2c685af1e9559504..923748d1cba7ef1571ba2f0600173ead4e1296e9 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
+#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
index 138b08e0697377e05afd17470cba39b2abc5a84d..61de3e81f1448d352c367d8596a145b1f597215e 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_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);
@@ -50,6 +51,9 @@ PHP_HTTP_API long _http_support(long feature)
 #      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;
index 2de5abbc2d4560fc80f3d0fdbd97a3e337903808..b8af494eb098a5012376a351ad963d30b4e1c412 100644 (file)
@@ -21,6 +21,7 @@
 #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
index 2105d4929fd713d18c980f45df4775f442eeefcf..8e97d402c8a5cb90897b1d75b5be67e04d63c628 100644 (file)
@@ -5,8 +5,7 @@ HttpRequestPool chain with libevent
 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