[Mono-bugs] [Bug 67996][Cri] New - Streaming an image from an OnBeginRequest handler
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 11 Oct 2004 16:41:56 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by codan3@msn.com.
http://bugzilla.ximian.com/show_bug.cgi?id=67996
--- shadow/67996 2004-10-11 16:41:56.000000000 -0400
+++ shadow/67996.tmp.24050 2004-10-11 16:41:56.000000000 -0400
@@ -0,0 +1,102 @@
+Bug#: 67996
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: apache 2.0.52 with mod_mono 1.0.2
+Status: NEW
+Resolution:
+Severity:
+Priority: Critical
+Component: Sys.Drawing.
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: codan3@msn.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Streaming an image from an OnBeginRequest handler
+
+Please fill in this template when reporting a bug, unless you know what
+you are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1. Save attached code as 'MonoTestImageStream.cs' and then compile with
+the following command:
+ mcs /t:library /out:MonoTestImageStream.dll -r:System.Web -
+r:System.Drawing MonoTestImageStream.cs
+
+2. Add the following to Web.config within system.web
+ <httpModules>
+ <add name="MonoTestImageStream"
+type="MonoTest.MonoTestImageStream, MonoTestImageStream" />
+ </httpModules>
+
+3. Create a blank index.aspx file (possible another bug... under MS.NET a
+the file doesn't have to exist for this to work.)
+
+4. Goto http://localhost:8080/index.aspx
+
+using System;
+using System.IO;
+using System.Web;
+using System.Drawing;
+using System.Drawing.Imaging;
+
+namespace MonoTest
+{
+ public class MonoTestImageStream : IHttpModule
+ {
+ public void Dispose()
+ {
+ }
+
+ public void Init(HttpApplication app)
+ {
+ app.BeginRequest += new EventHandler
+(this.OnBeginRequest);
+ }
+
+ public void OnBeginRequest(object s, EventArgs e)
+ {
+ HttpApplication webApp = (HttpApplication)s;
+
+ webApp.Context.Response.BufferOutput = true;
+ webApp.Context.Response.Clear();
+ webApp.Context.Response.ClearHeaders();
+ webApp.Context.Response.ClearContent();
+ webApp.Context.Response.StatusCode = 200;
+ webApp.Context.Response.ContentType = "image/gif";
+
+ Bitmap objBitMap = new Bitmap(640, 480);
+ Graphics g = Graphics.FromImage(objBitMap);
+
+ g.Clear(Color.Black);
+ MemoryStream memStream = new MemoryStream();
+
+ objBitMap.Save(memStream, ImageFormat.Gif);
+ Byte[] abyte = memStream.ToArray();
+ memStream.Close();
+ webApp.Context.Response.OutputStream.Write(abyte,
+0, abyte.Length);
+
+
+ webApp.Context.Response.End();
+ objBitMap.Dispose();
+ }
+ }
+}
+
+
+Actual Results:
+Server hangs
+
+Expected Results:
+Black 640x480 image
+
+How often does this happen?
+everytime
+
+Additional Information:
+This works as expected with MS.NET