Skip to content
This repository has been archived by the owner on Dec 14, 2020. It is now read-only.

Commit

Permalink
2009-06-04 Rolf Bjarne Kvinge <RKvinge@novell.com>
Browse files Browse the repository at this point in the history
	* GetFile.aspx.cs: Don't use WriteFile, deleting the file
	right after breaks apache.

svn path=/trunk/monkeywrench/; revision=135373
  • Loading branch information
rolfbjarne committed Jun 3, 2009
1 parent f414766 commit 4bab8b6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions MonkeyWrench.Web.UI/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2009-06-04 Rolf Bjarne Kvinge <RKvinge@novell.com>

* GetFile.aspx.cs: Don't use WriteFile, deleting the file
right after breaks apache.

2009-06-03 Rolf Bjarne Kvinge <RKvinge@novell.com>

* ViewWorkTable.aspx.designer.cs: Updated.
Expand Down
14 changes: 13 additions & 1 deletion MonkeyWrench.Web.UI/GetFile.aspx.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,19 @@ protected void Page_Load (object sender, EventArgs e)
Response.AppendHeader ("Content-Disposition", web.ResponseHeaders ["Content-Disposition"]);
Response.AppendHeader ("Content-Encoding", web.ResponseHeaders ["Content-Encoding"]);

Response.WriteFile (tmpfile);
byte [] buffer = new byte [1024];
int read;
using (FileStream fs = new FileStream (tmpfile, FileMode.Open, FileAccess.Read, FileShare.Read)) {
using (StreamReader reader = new StreamReader (fs)) {
while ((read = fs.Read (buffer, 0, buffer.Length)) != 0) {
Response.OutputStream.Write (buffer, 0, read);
}
}
}
// This would be the best I guess, but I get intermittent failures with
// " [error] command failed: failed to send file (file data)"
// in apache's error log
// Response.WriteFile (tmpfile);
Response.Flush ();
Response.Close ();
}
Expand Down

0 comments on commit 4bab8b6

Please sign in to comment.