- add pipelining support to HttpRequestPool (libcurl >= 7.16.0)
authorMichael Wallner <mike@php.net>
Sat, 9 Sep 2006 14:03:20 +0000 (14:03 +0000)
committerMichael Wallner <mike@php.net>
Sat, 9 Sep 2006 14:03:20 +0000 (14:03 +0000)
config9.m4
http_requestpool_object.c
package2.xml
php_http.h
php_http_requestpool_object.h

index 55397a75d78f5f53beaf22a7513e3045fcf0ae1d..1fcb91d3971e70d26d3d921057212046b862a032 100644 (file)
@@ -238,6 +238,10 @@ dnl ----
                        [AC_DEFINE([HAVE_CURL_FORMGET], [1], [ ])], [ ],
                        [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
                )
+               PHP_CHECK_LIBRARY(curl, curl_multi_setopt, 
+                       [AC_DEFINE([HAVE_CURL_MULTI_SETOPT], [1], [ ])], [ ], 
+                       [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
+               )
        fi
 
 dnl ----
index 69c3f9616a0ade832514f9e38e153d90d61c2655..ff8f75d4431e073faec37dffefa09a240998935a 100644 (file)
@@ -67,6 +67,10 @@ HTTP_EMPTY_ARGS(count);
 HTTP_EMPTY_ARGS(getAttachedRequests);
 HTTP_EMPTY_ARGS(getFinishedRequests);
 
+HTTP_BEGIN_ARGS(enablePipelining, 0)
+       HTTP_ARG_VAL(enable, 0)
+HTTP_END_ARGS;
+
 zend_class_entry *http_requestpool_object_ce;
 zend_function_entry http_requestpool_object_fe[] = {
        HTTP_REQPOOL_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
@@ -91,6 +95,8 @@ zend_function_entry http_requestpool_object_fe[] = {
        
        HTTP_REQPOOL_ME(getAttachedRequests, ZEND_ACC_PUBLIC)
        HTTP_REQPOOL_ME(getFinishedRequests, ZEND_ACC_PUBLIC)
+       
+       HTTP_REQPOOL_ME(enablePipelining, ZEND_ACC_PUBLIC)
 
        EMPTY_FUNCTION_ENTRY
 };
@@ -517,6 +523,29 @@ PHP_METHOD(HttpRequestPool, getFinishedRequests)
 }
 /* }}} */
 
+/* {{{ proto bool HttpRequest::enablePiplelinig([bool enable = true])
+ *
+ * Enables pipelining support for all attached requests if support in libcurl is given.
+ *
+ * Returns TRUE on success, or FALSE on failure.
+ */
+PHP_METHOD(HttpRequestPool, enablePipelining)
+{
+       zend_bool enable = 1;
+       getObject(http_requestpool_object, obj);
+       
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &enable)) {
+               RETURN_FALSE;
+       }
+#if defined(HAVE_CURL_MULTI_SETOPT) && HTTP_CURL_VERSION(7,16,0)
+       if (CURLM_OK == curl_multi_setopt(obj->pool.ch, CURLMOPT_PIPELINING, (long) enable)) {
+               RETURN_TRUE;
+       }
+#endif
+       RETURN_FALSE;
+}
+/* }}} */
+
 #endif /* ZEND_ENGINE_2 && HTTP_HAVE_CURL */
 
 /*
index 4fe58aab11843cac37fde2326602e05020000e12..15cfea57d356fb0010edc263e75782515d2c35c2 100644 (file)
@@ -28,10 +28,10 @@ support. Parallel requests are available for PHP 5 and greater.
   <email>mike@php.net</email>
   <active>yes</active>
  </lead>
- <date>2006-08-26</date>
+ <date>2006-09-00</date>
  <version>
-  <release>1.2.1</release>
-  <api>1.2.0</api>
+  <release>1.3.0dev</release>
+  <api>1.3.0</api>
  </version>
  <stability>
   <release>stable</release>
@@ -39,12 +39,7 @@ support. Parallel requests are available for PHP 5 and greater.
  </stability>
  <license>BSD, revised</license>
  <notes><![CDATA[
-+ Added HttpException::__toString() which takes care about any inner exceptions
-- Disallowed detaching HttpRequest objects from HttpRequestPool while executing progress callback
-* Fixed crash on detaching requests from pool in request event callbacks
-* Fixed suppression of nested exceptions in e.g. HttpRequestPool::send() (fixes bug #8535)
-* Fixed issues with inheritance and cloning of HttpDeflateStream, HttpInflateStream and HttpMessage
-  (Extending classes lose default properties on instantiation; Complex members ignored during cloning)
++ Added HttpRequestPool::enablePipielining([bool enable = TRUE]) (libcurl >= 7.16.0)
 ]]></notes>
  <contents>
   <dir name="/">
index 66ecbcc3e02d81288542296eb4a515d70eb11b93..7b922a76a1349217f55accc90496d210345074ac 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef PHP_EXT_HTTP_H
 #define PHP_EXT_HTTP_H
 
-#define PHP_EXT_HTTP_VERSION "1.2.1"
+#define PHP_EXT_HTTP_VERSION "1.3.0dev"
 
 #ifdef HAVE_CONFIG_H
 #      include "config.h"
index b0ab065b5e9b4660bdd539ddd0ddccb9264c02cc..7c7f6944883faf9999c51ddbc38e79f5fd6553a5 100644 (file)
@@ -51,6 +51,7 @@ PHP_METHOD(HttpRequestPool, rewind);
 PHP_METHOD(HttpRequestPool, count);
 PHP_METHOD(HttpRequestPool, getAttachedRequests);
 PHP_METHOD(HttpRequestPool, getFinishedRequests);
+PHP_METHOD(HttpRequestPool, enablePipelining);
 
 #endif
 #endif