The download started, then seemed to pause and hang.
I looked into it and found that all data is transfered, but the connection is not closed because of a
Quote:Connection: Keep-Alive
HTTP header sent back to the client. The download finished after my Apache server closed the connection.
I patched func/topic.php as follows:
Code:
diff -u -r1.1 topic.php
--- func/topic.php 12 Oct 2008 19:58:17 -0000 1.1
+++ func/topic.php 30 Jan 2009 20:28:57 -0000
@@ -586,11 +586,13 @@
session_write_close();
ini_set("zlib.output_compression", "Off");
+ header("Connection: close");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"{$data['attach_name']}\"");
header("Content-Length: " . $data['attach_size']);
header("X-Robots-Tag: noarchive, nosnippet, noindex");
- echo file_get_contents('./attachments/' . $data['attach_file']);
+ # directly pass through file to output buffer
+ @readfile ('./attachments/' . $data['attach_file']);
} else {
return $this->message($this->lang->topic_attached_title, $this->lang->topic_attached_perm);
}
While being at it, I also replaced the "echo file_get_contents(...)" by readfile() which should be more efficient.
Hope it heps,
Tino Emanuel.
PS: I patched my way around multibyte/UTF-8 problems as well - if anybody is interested, I'll contribute the patches (which involve missing German translations as well and fixing everything up for UTF-8).