Change the default config for cops_x_accel_redirect to let PHP handle the

download. Should fix problem from KevNancy on IIS.

Warning all Nginx users who wants to still use X-Accel-Redirect must add
$config['cops_x_accel_redirect'] = "X-Accel-Redirect" in their config_local

fix #33
This commit is contained in:
Sébastien Lucas 2013-01-19 06:19:46 +01:00
parent 2025bfc15e
commit a96888c76a
3 changed files with 15 additions and 5 deletions

View file

@ -97,5 +97,14 @@
} else {
header('Content-Disposition: attachment; filename="' . basename ($file) . '"');
}
header ($config['cops_x_accel_redirect'] . ": " . $config['calibre_internal_directory'] . $file);
if (empty ($config['cops_x_accel_redirect'])) {
$filename = $config['calibre_internal_directory'] . $file;
$fp = fopen($filename, 'rb');
header("Content-Length: " . filesize($filename));
fpassthru($fp);
}
else {
header ($config['cops_x_accel_redirect'] . ": " . $config['calibre_internal_directory'] . $file);
}
?>