Bug #1838
closedphp5 fast-cgi and file transfer
Description
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.
Files
Updated by stbuehler about 16 years ago
- Target version changed from 1.4.20 to 1.4.21
Updated by stbuehler about 16 years ago
- Status changed from New to Invalid
Your upload contains a Set-Cookie header, so you didn't show us the complete source. Your .php files probably just contain an empty line somewhere which gets included in the output.
Updated by mdoubez about 16 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.
Updated by mdoubez about 16 years ago
- % Done changed from 0 to 100
Indeed. There was a stray empty line deep in my code.
Sorry for the fuss and thanks a lot for the support.
Chhers
Also available in: Atom