Apply patch from Atsushi Enomoto to fix #397627
authorMiguel de Icaza <miguel@gnome.org>
Mon, 25 Aug 2008 19:45:39 +0000 (19:45 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Mon, 25 Aug 2008 19:45:39 +0000 (19:45 -0000)
svn path=/trunk/mcs/; revision=111562

mcs/class/System/System.Net/HttpWebRequest.cs
mcs/class/System/System.Net/WebConnectionStream.cs

index fcc839982474442ce03122df8dcef47e61ff14bd..775b645ed9d4213ceeee5215039fbe76f944ef2f 100644 (file)
@@ -1178,6 +1178,11 @@ namespace System.Net
                                try {
                                        redirected = CheckFinalStatus (r);
                                        if (!redirected) {
+                                               // clear internal buffer so that it does not
+                                               // hold possible big buffer (bug #397627)
+                                               if (writeStream != null)
+                                                       writeStream.KillBuffer ();
+
                                                r.SetCompleted (false, webResponse);
                                                r.DoCallback ();
                                        } else {
index 2e53437b3fec3f413ff226ca8c94bcf70d8999bb..61d6ff4fe4641315a959972ce94883bab202550c 100644 (file)
@@ -637,6 +637,11 @@ namespace System.Net
                        disposed = true;
                }
 
+               internal void KillBuffer ()
+               {
+                       writeBuffer = null;
+               }
+
                public override long Seek (long a, SeekOrigin b)
                {
                        throw new NotSupportedException ();