Re: AW: [PEAR-DEV] Proposal: HTTP_Download (another tiny package :)

From: Date: Fri, 26 Sep 2003 08:40:51 +0000
Subject: Re: AW: [PEAR-DEV] Proposal: HTTP_Download (another tiny package :)
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22067@lists.php.net to get a copy of this message
Hi! Stephan Schmidt wrote:
1) Range
Isn't this implemented already?
       /**
        * Handle partial downloads
        */
        $partial_length = null;
        if (preg_match('/^bytes:(\d*)-(\d*)$/i', $_SERVER['Range'], $bytes))
{
            $start  = $bytes[1] ? $bytes[1] : 0;
            $end    = $bytes[2] ? $bytes[2] : filesize($this->_file);
            $partial_length = $end - $start;
            if ($partial_length < 1) {
                $partial_length = null;
            }
        }
Whoops. Didn't look at a new version before writing. But now that I looked at it, it doesn't look as correct handling at all... The class should return status 416 if range is incorrect: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.17 The class should return status 206 if sending a part of a file http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.7 with correct Content-Range or Content-Type.

« previous php.pear.dev (#22067) next »