Re: Interesting question re HTTP Ranges and PHP
| From: | Curt Zirzow | Date: | Thu, 17 Jul 2003 07:10:26 +0000 |
| Subject: | Re: Interesting question re HTTP Ranges and PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-155556@lists.php.net to get a copy of this message | ||
Dan Goodes <dang@planetmirror.com> wrote:
> Hi folks,
>
> I currently have an interesting dilemma - any help is appreciated (if
> possible, CC directly to dang@planetmirror.com as well as the list).
>
> What Ive got is a PHP wrapper script that performs authetication, and uses
> "readfile()" to return the requested file. So a user requests
> /path/to/file, PHP interveins and performs authentication, then does a
> realfile on /REAL/path/to/file to return the file.
>
> What I want is for the PHP script to read ALL the headers for the request
> (in particular, RANGE headers), and then return the relevant portion of
> the file. Can this be done fairly simply? Obviously there has to be
> additional headers returned to the client by the script when it's
> returning a RANGE response. Also is there a way for PHP to tell apache
> which response code to send? i.e. in my testing even tho I send a "resume
> code" with wget, apache's response is 200 OK, not 206 Partial Content...
>
> Any help/advice is appreciated...
Now, first thing, I've tried this a while back with older versions of
apache and php and couldn't get success :(
it should be a rather simple task as long as the proper request and
response headers are sent back.
very first thing you want to send if the request if sufficient enough to
be a range request:
header('HTTP/1.0 206 Partial Content');
See RFC2616 10.2.7 for the response headers needed.
HTH,
Curt
--