From 0b5d61db388a4177ee32092b9fe7a4e614520bb2 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 5 Sep 2007 17:15:03 +0000 Subject: [PATCH] - release 1.6.0b1 --- package.xml | 17 ++++---- package2.xml | 2 +- scripts/bench_select_vs_event.php | 72 +++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 10 deletions(-) create mode 100644 scripts/bench_select_vs_event.php diff --git a/package.xml b/package.xml index bcfbc13..cc517ed 100644 --- a/package.xml +++ b/package.xml @@ -1,6 +1,6 @@ - + pecl_http Extended HTTP Support This HTTP extension aims to provide a convenient and powerful @@ -23,15 +23,14 @@ support. Parallel requests are available for PHP 5 and greater. - 1.5.2 - 2007-02-25 + 1.6.0b1 + 2007-09-05 BSD, revised - stable - * Fixed bug #10151 (build fails dynamic linking on Mac OS X) -* Allow setting the "proxyhost" request option to an empty string, - which lets curl ignore any environment settings -* Allow unsetting request options by passing NULL: - $request->setOptions(array("option" => NULL)); + beta + + Added 'retrycount' and 'retrydelay' request options ++ Added libevent support for libcurl (>= 7.16.0): + o added --with-http-curl-libevent configure option + o added HttpRequestPool::enableEvents() diff --git a/package2.xml b/package2.xml index ef11c52..beb0db0 100644 --- a/package2.xml +++ b/package2.xml @@ -28,7 +28,7 @@ support. Parallel requests are available for PHP 5 and greater. mike@php.net yes - 2007-06-12 + 2007-09-05 1.6.0b1 1.6.0 diff --git a/scripts/bench_select_vs_event.php b/scripts/bench_select_vs_event.php new file mode 100644 index 0000000..589f31e --- /dev/null +++ b/scripts/bench_select_vs_event.php @@ -0,0 +1,72 @@ +url = $url; + $pool->cnt = $n; + + $pool->enableEvents($e); + + for ($i = 0; $i < $c; ++$i) { + $pool->push(); + } + try { + $pool->send(); + } catch (Exception $ex) { + echo $ex, "\n"; + } + } + + function push() { + if ($this->cnt > 0) { + request::init($this, $this->url)->id = $this->cnt--; + } + } +} + +class request extends HttpRequest { + static $counter = 0; + + public $id; + private $pool; + + static function init(pool $pool, $url) { + $r = new request($url); + $r->pool = $pool; + $pool->attach($r); + return $r; + } + + function onFinish() { + ++self::$counter; + $this->pool->detach($this); + $this->pool->push(); + } +} + +function usage() { + global $argv; + fprintf(STDERR, "Usage: %s -u -n -c -e (use libevent)\n", $argv[0]); + fprintf(STDERR, "\nDefaults: -u http://localhost/ -n 1000 -c 10\n\n"); + exit(-1); +} + +isset($argv) or $argv = $_SERVER['argv']; +defined('STDERR') or define('STDERR', fopen('php://stderr', 'w')); + +$opts = getopt("u:c:n:e"); +isset($opts["u"]) or $opts["u"] = "http://localhost/"; +isset($opts["c"]) or $opts["c"] = 10; +isset($opts["n"]) or $opts["n"] = 1000; + +http_parse_message(http_head($opts["u"]))->responseCode == 200 or usage(); + +$time = microtime(true); +pool::fetch($opts["u"], $opts["n"], $opts["c"], isset($opts["e"])); +printf("\n> %10.6fs\n", microtime(true)-$time); + +request::$counter == $opts["n"] or printf("\nOnly %d finished\n", request::$counter); -- 2.30.2