I use the PHP virtual () function to send Apache 2.2 files (faster than readfile () ), and I can check user permissions.
But is there a way to add continuous download support, with HTTP_RANGE?
I tried such things
if(isset($_SERVER['HTTP_RANGE'])) { list($a, $range)=explode("=",$_SERVER['HTTP_RANGE']); str_replace($range, "-", $range); $size2=$size-1; $new_length=$size-$range; header("HTTP/1.1 206 Partial Content"); header("Content-Length: $new_length"); header("Content-Range: bytes $range$size2/$size"); apache_setenv('HTTP_RANGE', $_SERVER['HTTP_RANGE']); } else { $size2=$size-1; header("Content-Range: bytes 0-$size2/$size"); header("Content-Length: ".$size); }
Thus, the web client was loaded with files such as if HTTP_RANGE works, but in real Apache it always sends the same ranges of files, for example: if the client requests 4000-6000 bytes, Apache sends 0-2000, etc. , therefore the files were corrupted.
I think there is some way to do this with apache_setenv, but I can not find any suggestions about this on Google.
source share