Bug #2728
closedX-Sendfile corrupted files [user-error]
Description
I'm trying to create some zip files on the go and use X-sendfiles to download them, here is the relevant script I used:
exec("/usr/bin/zip -qj0 $tmp_file $mylist");
header("X-LIGHTTPD-send-file: $tmp_file" . ".zip");
exit();
However the downloaded file was always smaller than the one on the server. I have tried, using:
header("X-Sendfile2: $tmp_file" . ".zip 0-");
but same result. To get it working I needed to add the file size header, like:
exec("/usr/bin/zip -qj0 $tmp_file $mylist");
header("Content-Length: ".filesize($tmp_file.".zip"));
header("X-LIGHTTPD-send-file: $tmp_file" . ".zip");
exit();
My understanding of X-Sendfile was that we do not need to specify anything form the script since the WebServer will take care of it all. If I'm wrong apologies for raising the issue, but if I'm right there might be a slight bug somewhere.
Lighttpd version: 1.4.33
Server: Ubuntu 14.04
FastCGI: PHP-FPM 5.5.9
Opcance: Disabled
Spawn: Not installed
Updated by gstrauss almost 9 years ago
- Status changed from New to Invalid
Please ask your question in the support Forum (see the Forum tab at the top of this page)
Your script is incomplete. It looks like Perl. If so, then exec() is not what you want to use in your script. Try system() instead.
No further updates here. Please direct your questions to the forums.
Updated by gstrauss almost 9 years ago
- Subject changed from X-Sendfile corrupted files to X-Sendfile corrupted files [user-error]
Also available in: Atom