Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: classes/Download.php
- ===================================================================
- --- classes/Download.php (revision 706775)
- +++ classes/Download.php (working copy)
- @@ -416,7 +416,7 @@
- wp_die(__('Could not read file!', WPFB));
- $begin = 0;
- - $end = $size;
- + $end = $size - 1;
- $http_range = isset($_SERVER['HTTP_RANGE']) ? $_SERVER['HTTP_RANGE'] : '';
- if(!empty($http_range) && strpos($http_range, 'bytes=') !== false && strpos($http_range, ',') === false) // multi-range not supported (yet)!
- @@ -428,12 +428,12 @@
- } else
- $http_range = '';
- - if($begin > 0 || $end < $size)
- + if($begin > 0 || $end < ($size - 1))
- header('HTTP/1.0 206 Partial Content');
- else
- header('HTTP/1.0 200 OK');
- - $length = ($end-$begin);
- + $length = ($end - $begin + 1);
- WPFB_Download::AddTraffic($length);
- @@ -447,7 +447,7 @@
- }
- header("Content-Length: " . $length);
- if(!empty($http_range))
- - header("Content-Range: bytes " . $begin . "-" . ($end-1) . "/" . $size);
- + header("Content-Range: bytes " . $begin . "-" . $end . "/" . $size);
- // clean up things that are not needed for download
- @session_write_close(); // disable blocking of multiple downloads at the same time
- @@ -485,7 +485,7 @@
- while(!@feof($fh) && $cur < $end && @connection_status() == 0)
- {
- - $nbytes = min($buffer_size, $end-$cur);
- + $nbytes = min($buffer_size, $end - $cur + 1);
- $ts = microtime(true);
- print @fread($fh, $nbytes);
- @@ -534,4 +534,4 @@
- return array('error' => false, 'size' => $size);
- }
- -}
- \ No newline at end of file
- +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement