- split off files from tutorial.txt into lib/*.php
authorMichael Wallner <mike@php.net>
Mon, 6 Mar 2006 16:00:50 +0000 (16:00 +0000)
committerMichael Wallner <mike@php.net>
Mon, 6 Mar 2006 16:00:50 +0000 (16:00 +0000)
- prepare release v.25

13 files changed:
docs/examples/extract.php [deleted file]
docs/examples/tutorial.txt
lib/BigGet.php [new file with mode: 0644]
lib/FeedAggregator.php [new file with mode: 0644]
lib/PgLobStream.php [new file with mode: 0644]
lib/XmlRpcClient.php [new file with mode: 0644]
package.xml
package2.xml
php_http.h
rebuild
tests/HttpResponse_002.phpt
tests/HttpResponse_003.phpt
tests/HttpResponse_004.phpt

diff --git a/docs/examples/extract.php b/docs/examples/extract.php
deleted file mode 100644 (file)
index 466c544..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-/**
- * extract examples from tutorial.txt
- */
-
-if (preg_match_all('/\n- ([^\n]+).*?(\<\?.+?\?\>)/s', file_get_contents($_SERVER['argv'][1]), $matches)) {
-       for ($i = 0; $i < count($matches[0]); $i++) {
-               file_put_contents(preg_replace('/\W/', '_', $matches[1][$i]).".php", $matches[2][$i]."\n");
-       }
-}
-
-?>
index 1994f9e7ab850509265846e48f81a6478a685262..8d8998d0a05a5df8c588e85b38a60507d31ec3c9 100644 (file)
@@ -173,298 +173,3 @@ HttpResponse::setContentType('application/x-zip');
 HttpResponse::setFile('../archive.zip');
 HttpResponse::send();
 ?>
-
-Exemplar Use Cases
-------------------
-
-- KISS XMLRPC Client
-
-<?php
-class XmlRpcClient
-{
-       public $namespace;
-       protected $request;
-
-       public function __construct($url, $namespace = '')
-       {
-               $this->namespace = $namespace;
-               $this->request = new HttpRequest($url, HTTP_METH_POST);
-               $this->request->setContentType('text/xml');
-       }
-
-       public function setOptions($options = array())
-       {
-               return $this->request->setOptions($options);
-       }
-
-       public function addOptions($options)
-       {
-               return $this->request->addOptions($options);
-       }
-
-       public function __call($method, $params)
-       {
-               if ($this->namespace) {
-                       $method = $this->namespace .'.'. $method;
-               }
-               $this->request->setRawPostData(xmlrpc_encode_request($method, $params));
-               $response = $this->request->send();
-               if ($response->getResponseCode() != 200) {
-                       throw new Exception($response->getBody(), $response->getResponseCode());
-               }
-               return xmlrpc_decode($response->getBody(), 'utf-8');
-       }
-       
-       public function getHistory()
-       {
-               return $this->request->getHistory();
-       }
-}
-
-?>
-
-- Simple Feed Aggregator
-
-<?php
-class FeedAggregator
-{
-       public $directory;
-       protected $feeds = array();
-
-       public function __construct($directory = 'feeds')
-       {
-               $this->setDirectory($directory);
-       }
-
-       public function setDirectory($directory)
-       {
-               $this->directory = $directory;
-               foreach (glob($this->directory .'/*.xml') as $feed) {
-                       $this->feeds[basename($feed, '.xml')] = filemtime($feed);
-               }
-       }
-
-       public function url2name($url)
-       {
-               return preg_replace('/[^\w\.-]+/', '_', $url);
-       }
-       
-       public function hasFeed($url)
-       {
-               return isset($this->feeds[$this->url2name($url)]);
-       }
-
-       public function addFeed($url)
-       {
-               $r = $this->setupRequest($url);
-               $r->send();
-               $this->handleResponse($r);
-       }
-
-       public function addFeeds($urls)
-       {
-               $pool = new HttpRequestPool;
-               foreach ($urls as $url) {
-                       $pool->attach($r = $this->setupRequest($url));
-               }
-               $pool->send();
-
-               foreach ($pool as $request) {
-                       $this->handleResponse($request);
-               }
-       }
-
-       public function getFeed($url)
-       {
-               $this->addFeed($url);
-               return $this->loadFeed($this->url2name($url));
-       }
-
-       public function getFeeds($urls)
-       {
-               $feeds = array();
-               $this->addFeeds($urls);
-               foreach ($urls as $url) {
-                       $feeds[] = $this->loadFeed($this->url2name($url));
-               }
-               return $feeds;
-       }
-
-       protected function saveFeed($file, $contents)
-       {
-               if (file_put_contents($this->directory .'/'. $file .'.xml', $contents)) {
-                       $this->feeds[$file] = time();
-               } else {
-                       throw new Exception("Could not save feed contents to $file.xml");
-               }
-       }
-
-       protected function loadFeed($file)
-       {
-               if (isset($this->feeds[$file])) {
-                       if ($data = file_get_contents($this->directory .'/'. $file .'.xml')) {
-                               return $data;
-                       } else {
-                               throw new Exception("Could not load feed contents from $file.xml");
-                       }
-               } else {
-                       throw new Exception("Unknown feed/file $file.xml");
-               }
-       }
-
-       protected function setupRequest($url)
-       {
-               $r = new HttpRequest($url);
-               $r->setOptions(array('redirect' => true));
-
-               $file = $this->url2name($url);
-
-               if (isset($this->feeds[$file])) {
-                       $r->setOptions(array('lastmodified' => $this->feeds[$file]));
-               }
-
-               return $r;
-       }
-
-       protected function handleResponse(HttpRequest $r)
-       {
-               if ($r->getResponseCode() != 304) {
-                       if ($r->getResponseCode() != 200) {
-                               throw new Exception("Unexpected response code ". $r->getResponseCode());
-                       }
-                       if (!strlen($body = $r->getResponseBody())) {
-                               throw new Exception("Received empty feed from ". $r->getUrl());
-                       }
-                       $this->saveFeed($this->url2name($r->getUrl()), $body);
-               }
-       }
-}
-?>
-
-- Download a big file
-
-<?php
-
-/*
-       $bigGet = BigGet::url('http://www.example.com/big_file.bin');
-       $bigGet->saveTo('file.bin');
-*/
-
-class BigGetRequest extends HttpRequest
-{
-       public $id;
-}
-
-class BigGet extends HttpRequestPool
-{
-       const SIZE = 1048576;
-       
-       private $url;
-       private $size;
-       private $count = 0;
-       private $files = array();
-       
-       static function url($url)
-       {
-               $head = new HttpRequest($url, HttpRequest::METH_HEAD);
-               $headers = $head->send()->getHeaders();
-               $head = null;
-               
-               if (!isset($headers['Accept-Ranges'])) {
-                       throw new HttpException("Did not receive an Accept-Ranges header from HEAD $url");
-               }
-               if (!isset($headers['Content-Length'])) {
-                       throw new HttpException("Did not receive a Content-Length header from HEAD $url");
-               }
-               
-               $bigget = new BigGet;
-               $bigget->url = $url;
-               $bigget->size = $headers['Content-Length'];
-               return $bigget;
-       }
-       
-       function saveTo($file)
-       {
-               $this->send();
-               if ($w = fopen($file, 'wb')) {
-                       echo "\nCopying temp files to $file ...\n";
-                       foreach (glob("bigget_????.tmp") as $tmp) {
-                               echo "\t$tmp\n";
-                               if ($r = fopen($tmp, 'rb')) {
-                                       stream_copy_to_stream($r, $w);
-                                       fclose($r);
-                               }
-                               unlink($tmp);
-                       }
-                       fclose($w);
-                       echo "\nDone.\n";
-               }
-       }
-       
-       function send()
-       {
-               // use max 3 simultanous requests with a req size of 1MiB
-               while ($this->count < 3 && -1 != $offset = $this->getRangeOffset()) {
-                       $this->attachNew($offset);
-               }
-               
-               while ($this->socketPerform()) {
-                       if (!$this->socketSelect()) {
-                               throw new HttpSocketException;
-                       }
-               }
-       }
-       
-       private function attachNew($offset)
-       {
-               $stop = min($this->count * self::SIZE + self::SIZE, $this->size) - 1;
-               
-               echo "Attaching new request to get range: $offset-$stop\n";
-               
-               $req = new BigGetRequest(
-                       $this->url,
-                       HttpRequest::METH_GET,
-                       array(
-                               'headers' => array(
-                                       'Range' => "bytes=$offset-$stop"
-                               )
-                       )
-               );
-               $this->attach($req);
-               $req->id = $this->count++;
-       }
-       
-       private function getRangeOffset()
-       {
-               return ($this->size >= $start = $this->count * self::SIZE) ? $start : -1;
-       }
-       
-       protected function socketPerform()
-       {
-               try {
-                       $rc = parent::socketPerform();
-               } catch (HttpRequestPoolException $x) {
-                       foreach ($x->exceptionStack as $e) {
-                               echo $e->getMessage(), "\n";
-                       }
-               }
-               
-               foreach ($this->getFinishedRequests() as $r) {
-                       $this->detach($r);
-                       
-                       if (206 != $rc = $r->getResponseCode()) {
-                               throw new HttpException("Unexpected response code: $rc");
-                       }
-                       
-                       file_put_contents(sprintf("bigget_%04d.tmp", $r->id), $r->getResponseBody());
-                       
-                       if (-1 != $offset = $this->getRangeOffset()) {
-                               $this->attachNew($offset);
-                       }
-               }
-               
-               return $rc;
-       }
-}
-?>
-
diff --git a/lib/BigGet.php b/lib/BigGet.php
new file mode 100644 (file)
index 0000000..e61ef7e
--- /dev/null
@@ -0,0 +1,219 @@
+<?php
+
+/**
+ * BigGet - download big files efficiently
+ * $Id$
+ * 
+ * @copyright   Michael Wallner, <mike@iworks.at>
+ * @license     BSD, revised
+ * @version     $Revision$
+ */
+class BigGet extends HttpRequestPool
+{
+    /**
+     * File split size
+     */
+       const SIZE = 1048576;
+       
+       /**
+        * Parallel Request count
+        */
+       const RMAX = 5;
+       
+       /**
+        * Whether to output debug messages
+        * 
+        * @var bool
+        */
+       public $dbg = false;
+       
+       /**
+        * URL
+        *
+        * @var string
+        */
+       private $url;
+       
+       /**
+        * Temp file prefix
+        * 
+        * @var string
+        */
+       private $tmp;
+       
+       /**
+        * Size of requested resource
+        *
+        * @var int
+        */
+       private $size;
+       
+       /**
+        * Whether the requests have been sent
+        *
+        * @var bool
+        */
+       private $sent = false;
+       
+       /**
+        * Request counter
+        *
+        * @var int
+        */
+       private $count = 0;
+       
+       /**
+        * Static constructor
+        *
+        * @param string $url
+        * @param string $tmp
+        * @return BigGet
+        * @throws Exception
+        */
+       public static function url($url, $tmp = '/tmp')
+       {
+               $head = new HttpRequest($url, HttpRequest::METH_HEAD);
+               $headers = $head->send()->getHeaders();
+               
+               if (200 != $head->getResponseCode()) {
+                   throw new HttpException("Did not receive '200 Ok' from HEAD $url");
+               }
+               if (!isset($headers['Accept-Ranges'])) {
+                       throw new HttpException("Did not receive an Accept-Ranges header from HEAD $url");
+               }
+               if (!isset($headers['Content-Length'])) {
+                       throw new HttpException("Did not receive a Content-Length header from HEAD $url");
+               }
+               
+               $bigget = new BigGet;
+               $bigget->url = $url;
+               $bigget->tmp = tempnam($tmp, 'BigGet.');
+               $bigget->size = $headers['Content-Length'];
+               return $bigget;
+       }
+       
+       /**
+        * Save the resource to a file
+        *
+        * @param string $file
+        * @return bool
+        * @throws Exception
+        */
+       public function saveTo($file)
+       {
+               $this->sent or $this->send();
+               
+               if ($w = fopen($this->tmp, 'wb')) {
+                   
+                       $this->dbg && print "\nCopying temp files to $file ...\n";
+                       
+                       foreach (glob($this->tmp .".????") as $tmp) {
+                           
+                               $this->dbg && print "\t$tmp\n";
+                               
+                               if ($r = fopen($tmp, 'rb')) {
+                                       stream_copy_to_stream($r, $w);
+                                       fclose($r);
+                               }
+                               unlink($tmp);
+                       }
+                       fclose($w);
+                       rename($this->tmp, $file);
+                       
+                       $this->dbg && print "\nDone.\n";
+                       
+                       return true;
+               }
+               return false;
+       }
+       
+       /**
+        * Overrides HttpRequestPool::send()
+        *
+        * @return void
+        * @throws Exception
+        */
+       public function send()
+       {
+           $this->sent = true;
+           
+               // use max RMAX simultanous requests with a req size of SIZE
+               while ($this->count < self::RMAX && -1 != $offset = $this->getRangeOffset()) {
+                       $this->attachNew($offset);
+               }
+               
+               while ($this->socketPerform()) {
+                       if (!$this->socketSelect()) {
+                               throw new HttpSocketException;
+                       }
+               }
+       }
+       
+       /**
+        * Overrides HttpRequestPool::socketPerform()
+        *
+        * @return bool
+        */
+       protected function socketPerform()
+       {
+               try {
+                       $rs = parent::socketPerform();
+               } catch (HttpRequestPoolException $x) {
+                       foreach ($x->exceptionStack as $e) {
+                               echo $e->getMessage(), "\n";
+                       }
+               }
+               
+               foreach ($this->getFinishedRequests() as $r) {
+                       $this->detach($r);
+                       
+                       if (206 != $rc = $r->getResponseCode()) {
+                               throw new HttpException("Unexpected response code: $rc");
+                       }
+                       
+                       file_put_contents(sprintf("%s.%04d", $this->tmp, $r->id), $r->getResponseBody());
+                       
+                       if (-1 != $offset = $this->getRangeOffset()) {
+                               $this->attachNew($offset);
+                       }
+               }
+               
+               return $rs;
+       }
+       
+       private function attachNew($offset)
+       {
+               $stop = min($this->count * self::SIZE + self::SIZE, $this->size) - 1;
+               
+               $this->dbg && print "Attaching new request to get range: $offset-$stop\n";
+               
+               $req = new BigGetRequest(
+                       $this->url,
+                       HttpRequest::METH_GET,
+                       array(
+                               'headers' => array(
+                                       'Range' => "bytes=$offset-$stop"
+                               )
+                       )
+               );
+               $this->attach($req);
+               $req->id = $this->count++;
+       }
+       
+       private function getRangeOffset()
+       {
+               return ($this->size >= $start = $this->count * self::SIZE) ? $start : -1;
+       }
+}
+
+
+/**
+ * BigGet request
+ * @ignore
+ */
+class BigGetRequest extends HttpRequest
+{
+       public $id;
+}
+
+?>
diff --git a/lib/FeedAggregator.php b/lib/FeedAggregator.php
new file mode 100644 (file)
index 0000000..de2ae0b
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+
+/**
+ * Simple Feed Aggregator
+ * $Id$
+ * 
+ * @copyright   Michael Wallner, <mike@iworks.at>
+ * @license     BSD, revised
+ * @package     pecl/http
+ * @version     $Revision$
+ */
+class FeedAggregator
+{
+    /**
+     * Cache directory
+     *
+     * @var string
+     */
+       public $directory;
+       
+       /**
+        * Feeds
+        *
+        * @var array
+        */
+       protected $feeds = array();
+
+       /**
+        * Constructor
+        *
+        * @param string $directory
+        */
+       public function __construct($directory = 'feeds')
+       {
+               $this->setDirectory($directory);
+       }
+
+       /**
+        * Set cache directory
+        *
+        * @param string $directory
+        */
+       public function setDirectory($directory)
+       {
+               $this->directory = $directory;
+               foreach (glob($this->directory .'/*.xml') as $feed) {
+                       $this->feeds[basename($feed, '.xml')] = filemtime($feed);
+               }
+       }
+
+       /**
+        * Strips all special chars
+        *
+        * @param string $url
+        * @return string
+        */
+       public function url2name($url)
+       {
+               return preg_replace('/[^\w\.-]+/', '_', $url);
+       }
+       
+       /**
+        * Checks if $url is a known feed
+        *
+        * @param string $url
+        * @return bool
+        */
+       public function hasFeed($url)
+       {
+               return isset($this->feeds[$this->url2name($url)]);
+       }
+
+       /**
+        * Add an URL as feed
+        *
+        * @param string $url
+        * @return void
+        * @throws Exception
+        */
+       public function addFeed($url)
+       {
+               $r = $this->setupRequest($url);
+               $r->send();
+               $this->handleResponse($r);
+       }
+
+       /**
+        * Add several URLs as feeds
+        *
+        * @param array $urls
+        * @return void
+        * @throws Exception
+        */
+       public function addFeeds(array $urls)
+       {
+               $pool = new HttpRequestPool;
+               foreach ($urls as $url) {
+                       $pool->attach($r = $this->setupRequest($url));
+               }
+               $pool->send();
+
+               foreach ($pool as $request) {
+                       $this->handleResponse($request);
+               }
+       }
+
+       /**
+        * Load a feed (from cache)
+        *
+        * @param string $url
+        * @return string
+        * @throws Exception
+        */
+       public function getFeed($url)
+       {
+               $this->addFeed($url);
+               return $this->loadFeed($this->url2name($url));
+       }
+
+       /**
+        * Load several feeds (from cache)
+        *
+        * @param array $urls
+        * @return array
+        * @throws Exception
+        */
+       public function getFeeds(array $urls)
+       {
+               $feeds = array();
+               $this->addFeeds($urls);
+               foreach ($urls as $url) {
+                       $feeds[] = $this->loadFeed($this->url2name($url));
+               }
+               return $feeds;
+       }
+
+       protected function saveFeed($file, $contents)
+       {
+               if (file_put_contents($this->directory .'/'. $file .'.xml', $contents)) {
+                       $this->feeds[$file] = time();
+               } else {
+                       throw new Exception("Could not save feed contents to $file.xml");
+               }
+       }
+
+       protected function loadFeed($file)
+       {
+               if (isset($this->feeds[$file])) {
+                       if ($data = file_get_contents($this->directory .'/'. $file .'.xml')) {
+                               return $data;
+                       } else {
+                               throw new Exception("Could not load feed contents from $file.xml");
+                       }
+               } else {
+                       throw new Exception("Unknown feed/file $file.xml");
+               }
+       }
+
+       protected function setupRequest($url, $escape = true)
+       {
+               $r = new HttpRequest($url);
+               $r->setOptions(array('redirect' => true));
+
+               $file = $escape ? $this->url2name($url) : $url;
+
+               if (isset($this->feeds[$file])) {
+                       $r->setOptions(array('lastmodified' => $this->feeds[$file]));
+               }
+
+               return $r;
+       }
+
+       protected function handleResponse(HttpRequest $r)
+       {
+               if ($r->getResponseCode() != 304) {
+                       if ($r->getResponseCode() != 200) {
+                               throw new Exception("Unexpected response code ". $r->getResponseCode());
+                       }
+                       if (!strlen($body = $r->getResponseBody())) {
+                               throw new Exception("Received empty feed from ". $r->getUrl());
+                       }
+                       $this->saveFeed($this->url2name($r->getUrl()), $body);
+               }
+       }
+}
+
+?>
diff --git a/lib/PgLobStream.php b/lib/PgLobStream.php
new file mode 100644 (file)
index 0000000..b6927bf
--- /dev/null
@@ -0,0 +1,100 @@
+<?php
+
+/**
+ * PostgreSQL LOB stream
+ * $Id$
+ * 
+ * Usage:
+ * <code>
+ * // GET /image.php?image=1234
+ * if (PgLobStream::$loId = (int) $_GET['image']) {
+ *     if ($lob = fopen('pglob: dbname=database user=mike', 'r')) {
+ *         HttpResponse::setContentType('image/jpeg');
+ *         HttpResponse::setStream($lob);
+ *         HttpResponse::send();
+ *     }
+ * }
+ * </code>
+ * 
+ * @copyright   Michael Wallner, <mike@iworks.at>
+ * @license     BSD, revised
+ * @package     pecl/http
+ * @version     $Revision$
+ */
+class PgLobStream
+{
+    private $dbh;
+    private $loh;
+    private $lon;
+    private $size = 0;
+    
+    public static $loId;
+
+    function stream_open($path, $mode)
+    {
+        $path = trim(parse_url($path, URL_PATH));
+        
+        if ($path) {
+            if ($this->dbh = pg_connect($path)) {
+                if (pg_query($this->dbh, 'BEGIN')) {
+                    if (is_resource($this->loh = pg_lo_open($this->dbh, $this->lon = self::$loId, $mode))) {
+                        pg_lo_seek($this->loh, 0, PGSQL_SEEK_END);
+                        $this->size = (int) pg_lo_tell($this->loh);
+                        pg_lo_seek($this->loh, 0, PGSSQL_SEEK_SET);
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+    
+    function stream_read($length)
+    {
+        return pg_lo_read($this->loh, $length);
+    }
+    
+    function stream_seek($offset, $whence = SEEK_SET)
+    {
+        return pg_lo_seek($this->loh, $offset, $whence);
+    }
+    
+    function stream_tell()
+    {
+        return pg_lo_tell($this->loh);
+    }
+    
+    function stream_eof()
+    {
+        return pg_lo_tell($this->loh) >= $this->size;
+    }
+    
+    function stream_flush()
+    {
+        return true;
+    }
+    
+    function stream_stat()
+    {
+        return array('size' => $this->size, 'ino' => $this->lon);
+    }
+    
+    function stream_write($data)
+    {
+        return pg_lo_write($this->loh, $data);
+    }
+    
+    function stream_close()
+    {
+        if (pg_lo_close($this->loh)) {
+            return pg_query($this->dbh, 'COMMIT');
+        } else {
+            pg_query($this->dbh, 'ROLLBACK');
+            return false;
+        }
+    }
+}
+
+stream_register_wrapper('pglob', 'PgLobStream');
+
+?>
diff --git a/lib/XmlRpcClient.php b/lib/XmlRpcClient.php
new file mode 100644 (file)
index 0000000..f36347d
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+
+/**
+ * XMLRPC Client, very KISS
+ * $Id$
+ * 
+ * NOTE: requires ext/xmlrpc
+ * 
+ * Usage:
+ * <code>
+ * <?php
+ * $rpc = new XmlRpcClient('http://mike:secret@example.com/cgi-bin/vpop-xmlrpc', 'vpop');
+ * try {
+ *     print_r($rpc->listdomain(array('domain' => 'example.com'));
+ * } catch (Exception $ex) {
+ *     echo $ex;
+ * }
+ * ?>
+ * </code>
+ * 
+ * @copyright   Michael Wallner, <mike@iworks.at>
+ * @license     BSD, revised
+ * @package     pecl/http
+ * @version     $Revision$
+ */
+class XmlRpcClient
+{
+    /**
+     * RPC namespace
+     *
+     * @var string
+     */
+       public $namespace;
+       
+       /**
+        * HttpRequest instance
+        *
+        * @var HttpRequest
+        */
+       protected $request;
+
+       /**
+        * Constructor
+        *
+        * @param string $url RPC endpoint
+        * @param string $namespace RPC namespace
+        */
+       public function __construct($url, $namespace = '')
+       {
+               $this->namespace = $namespace;
+               $this->request = new HttpRequest($url, HTTP_METH_POST);
+               $this->request->setContentType('text/xml');
+       }
+
+       /**
+        * Proxy to HttpRequest::setOptions()
+        *
+        * @param array $options
+        * @return unknown
+        */
+       public function setOptions(array $options = null)
+       {
+               return $this->request->setOptions($options);
+       }
+       
+       /**
+        * Get associated HttpRequest instance
+        *
+        * @return HttpRequest
+        */
+       public function getRequest()
+       {
+           return $this->request;
+       }
+
+       /**
+        * RPC method proxy
+        *
+        * @param string $method RPC method name
+        * @param array $params RPC method arguments
+        * @return mixed decoded RPC response
+        * @throws Exception
+        */
+       public function __call($method, array $params)
+       {
+               if ($this->namespace) {
+                       $method = $this->namespace .'.'. $method;
+               }
+               $this->request->setRawPostData(xmlrpc_encode_request($method, $params));
+               $response = $this->request->send();
+               if ($response->getResponseCode() != 200) {
+                       throw new Exception($response->getBody(), $response->getResponseCode());
+               }
+               return xmlrpc_decode($response->getBody(), 'utf-8');
+       }
+}
+
+?>
index 4342a48e6c4a5267a7258596833c9522ab92e458..df1a694a77636297dc79518d53a6b5fae15e04c2 100644 (file)
@@ -30,12 +30,17 @@ HttpResponse
   </maintainer>
   </maintainers>
  <release>
-  <version>0.24.1</version>
-  <date>2006-02-23</date>
+  <version>0.25.0</version>
+  <date>2006-03-06</date>
   <license>BSD, revised</license>
   <state>beta</state>
-  <notes>* Fixed bug #6861 - 5 digit ports get truncated
-* Fixed bug with non-functional HttpRequest::setContentType()
+  <notes>* Fixed bug #6924 (Linking fails on Mac OSX).
+* Fixed HttpRequest::addRawPostData().
+
++ Added feature request http_put_data() and HttpRequest::(set|get|add)PutData().
++ Added &apos;range&apos; request option.
++ Added &apos;proxytype&apos; request option.
++ Added HTTP_PROXY_HTTP, HTTP_PROXY_SOCKS4, HTTP_PROXY_SOCKS5 constants.
   </notes>
   <deps>
    <dep type="php" rel="ge" version="4.3"/>
@@ -49,12 +54,17 @@ HttpResponse
   <filelist>
    <dir name="docs">
     <dir name="examples">
-     <file role="doc" install-as="examples/extract.php" name="extract.php"/>
      <file role="doc" install-as="examples/tutorial.txt" name="tutorial.txt"/>
     </dir> <!-- /docs/examples -->
     <file role="doc" install-as="functions.html" name="functions.html"/>
     <file role="doc" install-as="http.ini" name="http.ini"/>
    </dir> <!-- /docs -->
+   <dir name="lib">
+    <file role="php" install-as="pecl/http/BigGet.php" name="BigGet.php"/>
+    <file role="php" install-as="pecl/http/FeedAggregator.php" name="FeedAggregator.php"/>
+    <file role="php" install-as="pecl/http/PgLobStream.php" name="PgLobStream.php"/>
+    <file role="php" install-as="pecl/http/XmlRpcClient.php" name="XmlRpcClient.php"/>
+   </dir> <!-- /lib -->
    <dir name="phpstr">
     <file role="src" name="phpstr.c"/>
     <file role="src" name="phpstr.h"/>
@@ -154,6 +164,7 @@ HttpResponse
     <file role="test" name="request_etag.phpt"/>
     <file role="test" name="request_gzip.phpt"/>
     <file role="test" name="request_methods.phpt"/>
+    <file role="test" name="request_put_data.phpt"/>
     <file role="test" name="send_data_001.phpt"/>
     <file role="test" name="send_data_002.phpt"/>
     <file role="test" name="send_data_003.phpt"/>
index ec7504ba09f59d1ba6df7023fe99c0c50546f4c7..0a7b5f6d82da843fbefb0f065a7e820ffb5cff3f 100644 (file)
@@ -62,7 +62,6 @@ HttpResponse
    <file role="doc" name="KnownIssues.txt"/>
    <file role="doc" name="docs/http.ini"/>
    <file role="doc" name="docs/functions.html"/>
-   <file role="doc" name="docs/examples/extract.php"/>
    <file role="doc" name="docs/examples/tutorial.txt"/>
    
    <file role="src" name="http.dsp"/>
@@ -132,6 +131,13 @@ HttpResponse
    <file role="src" name="http_response_object.c"/>
    <file role="src" name="http_exception_object.c"/>
    
+   <dir name="lib">
+    <file role="php" name="BigGet.php"/>
+    <file role="php" name="FeedAggregator.php"/>
+    <file role="php" name="PgLobStream.php"/>
+    <file role="php" name="XmlRpcClient.php"/>
+   </dir>
+   
    <dir name="tests">
     <file role="test" name="data.txt"/>
     <file role="test" name="urls.txt"/>
@@ -299,8 +305,11 @@ HttpResponse
   <filelist>
    <install as="http.ini" name="docs/http.ini"/>
    <install as="functions.html" name="docs/functions.html"/>
-   <install as="examples/extract.php" name="docs/examples/extract.php"/>
    <install as="examples/tutorial.txt" name="docs/examples/tutorial.txt"/>
+   <install as="pecl/http/BigGet.php" name="lib/BigGet.php"/>
+   <install as="pecl/http/FeedAggregator.php" name="lib/FeedAggregator.php"/>
+   <install as="pecl/http/PgLobStream.php" name="lib/PgLobStream.php"/>
+   <install as="pecl/http/XmlRpcClient.php" name="lib/XmlRpcClient.php"/>
   </filelist>
  </extsrcrelease>
  <changelog />
index b327d228770fbb70335776fb3b4ec20038211174..9516a7cd90bed319866760d141f4063227edb7e9 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef PHP_EXT_HTTP_H
 #define PHP_EXT_HTTP_H
 
-#define PHP_EXT_HTTP_VERSION "0.25.0dev"
+#define PHP_EXT_HTTP_VERSION "0.25.0"
 
 #ifdef HAVE_CONFIG_H
 #      include "config.h"
diff --git a/rebuild b/rebuild
index fe6576e2e49d3b2c34bb6b8ce8db007efc37a939..b7f97c87625337f93638713918682d88dba179a9 100755 (executable)
--- a/rebuild
+++ b/rebuild
@@ -4,7 +4,7 @@ rm -f warnings
 if test -d "$1"; then
     PREFIX=$1
 else
-    PREFIX=/opt
+    PREFIX=`dirname $(dirname $(which php-config))`
 fi
 
 echo "Using prefix '$PREFIX' for phpize and php-config!"
index 72c22bcd574096a1e294e4503219e8e90a4bd585..49ad6fa4b44899081548adadd0d7f29440fae85f 100644 (file)
@@ -5,7 +5,7 @@ HttpResponse - send gzipped file
 include 'skip.inc';
 checkmin(5);
 checkcgi();
-checkext('zlib');
+skipif(!http_support(HTTP_SUPPORT_ENCODINGS), "need zlib support");
 ?>
 --ENV--
 HTTP_ACCEPT_ENCODING=gzip
index 960c0c5814b6dce177a49cf4bcc7c67d36fdd43a..9780dda00cb1c67b7cfcbcf028c89a582aeecab1 100644 (file)
@@ -5,7 +5,7 @@ HttpResponse - send gzipped file with caching headers
 include 'skip.inc';
 checkmin(5);
 checkcgi();
-checkext('zlib');
+skipif(!http_support(HTTP_SUPPORT_ENCODINGS), "need zlib support");
 ?>
 --ENV--
 HTTP_ACCEPT_ENCODING=gzip
index f5e768dd0299da42262fb3deec680dda19325f59..e8a1d0f758b05279da903213bec4ed8022100f7c 100644 (file)
@@ -5,7 +5,7 @@ HttpResponse - send cached gzipped data
 include 'skip.inc';
 checkcgi();
 checkmin(5.1);
-checkext('zlib');
+skpif(!http_support(HTTP_SUPPORT_ENCODINGS), "need zlib support");
 ?>
 --ENV--
 HTTP_ACCEPT_ENCODING=gzip