Example #1
0
/**
* HTTP range support (RFC 2616 Section 14.35)
*
* Allows browsers to request partial file content
* in case a download has been interrupted.
*
* @param int $filesize		the size of the file in bytes we are about to deliver
*
* @return mixed		false if the whole file has to be delivered
*					associative array on success
*/
function phpbb_http_byte_range($filesize)
{
    // Only call find_range_request() once.
    static $request_array;
    if (!$filesize) {
        return false;
    }
    if (!isset($request_array)) {
        $request_array = phpbb_find_range_request();
    }
    return empty($request_array) ? false : phpbb_parse_range_request($request_array, $filesize);
}
Example #2
0
 /**
  * @dataProvider parse_range_request_data()
  */
 public function test_parse_range_request($request_array, $filesize, $expected)
 {
     $this->assertEquals($expected, phpbb_parse_range_request($request_array, $filesize));
 }