php5 fast-cgi and file transfer
When trying to transfer a file from a PHP script a 0x0a byte is inserted at the beginning of the file. I guess this is a mistach between php-fastcgi and lighttpd handling of the number of carriage return after headers.
Script is of the form:
$filename=strftime('%Y-%m-%dT%H:%M:%S').'.tar'; header('Content-Description: File Transfer'); header('Content-Type: "application/x-tar"'); header('Content-Disposition: attachment; filename="'.$filename.'"'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: no-cache'); header('Pragma: pulic'); header("Accept-Ranges: bytes"); header('Connection: close'); flush(); echo "test"; //passthru('/bin/tar -C '.$arch.' -cO *-*-*T*:*:*'); exit;
Find in attachement the file I get from downloading. I expected "test\n" and got "\ntest\n".
Also find The Ethereal related tcp stream.
The same happened in version 1.4.19. I am under linux, PHP version: 5.2.6.
Updated by mdoubez over 11 years ago
This is part of a codeigniter application so headers may be inserted outside my application but I don't see where an empty line would modify the output in PHP unless there as a hidden echo "" somewhere.
I will try with a pristine script and reopen the bug report if it is confirmed.
Also available in: Atom