Project

General

Profile

Bug #1838

php5 fast-cgi and file transfer

Added by mdoubez almost 11 years ago. Updated almost 11 years ago.

Status:
Invalid
Priority:
Normal
Assignee:
-
Category:
mod_fastcgi
Target version:
Start date:
2008-12-05
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

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.

arch.tar.txt (5 Bytes) arch.tar.txt File downloaded with script mdoubez, 2008-12-05 11:33
tcp_stream.txt (1.76 KB) tcp_stream.txt Ethereal tcp stream in ASCII format mdoubez, 2008-12-05 11:33
tcp_stream.hex (13.1 KB) tcp_stream.hex Ethereal tcp stream in hexdump format mdoubez, 2008-12-05 11:33

History

#1

Updated by stbuehler almost 11 years ago

  • Target version changed from 1.4.20 to 1.4.21
#2

Updated by stbuehler almost 11 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.

#3

Updated by mdoubez almost 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.

#4

Updated by mdoubez almost 11 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