HttpRequest: weird use case
| From: | Matt Kynx | Date: | Thu, 05 Jul 2012 00:20:39 +0000 |
| Subject: | HttpRequest: weird use case | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-9571@lists.php.net to get a copy of this message | ||
Heya,
I'm working on a stream wrapper for Rackspace Cloudfiles. It's got a
REST interface, which brings me here.
Imagine I've got a clever script to save something from a stream to a
container in cloudfiles. Using it might look like:
$ mysqldump -a | gzip -c | cfpipe.php /container/path/to/backup.sql.gz
All cfphipe.php does is copy(STDIN, 'rscf://container/path/to/backup.sql.gz').
Current implementations either hold the whole stream in memory or save
it to a temp file. Rackspace supports sending the files using
Transfer-Encoding: chunked, which avoids this overhead. What I need to
do is:
authenticate
open connection
send headers with Transfer-Enconding: chunked
stream chunk
see if total transfered >
5. stream chunk
......
nnn. stream last chunk
nnn+1. read response and compare checksum