Author: gonzalo
Date: 2005-06-26 16:15:40 -0400 (Sun, 26 Jun 2005)
New Revision: 46523

Modified:
   trunk/mcs/class/System.Web/System.Web/ChangeLog
   trunk/mcs/class/System.Web/System.Web/HttpResponse.cs
Log:
2005-06-26 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>

        * HttpResponse.cs: ensure that the last chunk ('0\r\n\r\n') is sent
        even if response.Close is called before a final flush. MS/IIS fails to
        do this.



Modified: trunk/mcs/class/System.Web/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web/ChangeLog     2005-06-26 18:43:12 UTC 
(rev 46522)
+++ trunk/mcs/class/System.Web/System.Web/ChangeLog     2005-06-26 20:15:40 UTC 
(rev 46523)
@@ -1,3 +1,9 @@
+2005-06-26 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * HttpResponse.cs: ensure that the last chunk ('0\r\n\r\n') is sent
+       even if response.Close is called before a final flush. MS/IIS fails to
+       do this.
+
 2005-06-25 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * HttpRequest.cs: don't print anything for unknown content types in

Modified: trunk/mcs/class/System.Web/System.Web/HttpResponse.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpResponse.cs       2005-06-26 
18:43:12 UTC (rev 46522)
+++ trunk/mcs/class/System.Web/System.Web/HttpResponse.cs       2005-06-26 
20:15:40 UTC (rev 46523)
@@ -52,6 +52,7 @@
                bool _bSuppressHeaders;
                bool _bSuppressContent;
                bool _bChunked;
+               bool last_chunk_sent;
                bool _bEnded;
                bool _bBuffering;
                bool _bHeadersSent;
@@ -724,6 +725,10 @@
                public void Close ()
                {
                        if (!closed && !_bClientDisconnected) {
+                               if (_bChunked && !last_chunk_sent) {
+                                       last_chunk_sent = true;
+                                       _WorkerRequest.SendResponseFromMemory 
(s_arrChunkEnd, s_arrChunkEnd.Length);
+                               }
                                _WorkerRequest.CloseConnection ();
                                _bClientDisconnected = true;
                                closed = true;
@@ -825,8 +830,8 @@
 
                                if (length == 0) {
                                        if (bFinish && _bChunked) {
-                                               
_WorkerRequest.SendResponseFromMemory (s_arrChunkEnd,
-                                                                               
s_arrChunkEnd.Length);
+                                               last_chunk_sent = true;
+                                               
_WorkerRequest.SendResponseFromMemory (s_arrChunkEnd, s_arrChunkEnd.Length);
                                        }
 
                                        _WorkerRequest.FlushResponse (bFinish);
@@ -856,9 +861,11 @@
 
                                                
_WorkerRequest.SendResponseFromMemory (s_arrChunkSuffix,
                                                                                
       s_arrChunkSuffix.Length);
-                                               if (bFinish)
+                                               if (bFinish) {
+                                                       last_chunk_sent = true;
                                                        
_WorkerRequest.SendResponseFromMemory (
                                                                        
s_arrChunkEnd, s_arrChunkEnd.Length);
+                                               }
                                        } else {
                                                _Writer.SendContent 
(_WorkerRequest);
                                        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to