Skip to content

Commit

Permalink
Merge b9faec8 into f65537c
Browse files Browse the repository at this point in the history
  • Loading branch information
allandanton committed Sep 14, 2022
2 parents f65537c + b9faec8 commit f461d3b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* COPS (Calibre OPDS PHP Server)
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Sébastien Lucas <sebastien@slucas.fr>
* @author Sébastien Lucas <sebastien@slucas.fr>
*/

require_once dirname(__FILE__) . '/config.php';
Expand All @@ -18,6 +18,8 @@
return;
}
}
// clean output buffers before sending the ebook data do avoid high memory usage on big ebooks (ie. comic books)
ob_end_clean();

$expires = 60*60*24*14;
header('Pragma: public');
Expand Down Expand Up @@ -118,9 +120,9 @@

if (empty($config['cops_x_accel_redirect'])) {
$filename = $dir . $file;
$fp = fopen($filename, 'rb');
header('Content-Length: ' . filesize($filename));
fpassthru($fp);
readfile($filename);
} else {
header($config['cops_x_accel_redirect'] . ': ' . $dir . $file);
}
exit();

0 comments on commit f461d3b

Please sign in to comment.