Browse Source

2003-05-29 Miguel de Icaza <[email protected]>

	* HttpWebRequest.cs (Close): Move the code that accumulates the
	output to Close from Flush.  Flush could have been called in the
	middle of the processing, and would have generated invalid results
	(which it did).

svn path=/trunk/mcs/; revision=15000
Miguel de Icaza 22 years ago
parent
commit
bd2c60b6ed
2 changed files with 21 additions and 16 deletions
  1. 7 0
      mcs/class/System/System.Net/ChangeLog
  2. 14 16
      mcs/class/System/System.Net/HttpWebRequest.cs

+ 7 - 0
mcs/class/System/System.Net/ChangeLog

@@ -1,3 +1,10 @@
+2003-05-29  Miguel de Icaza  <[email protected]>
+
+	* HttpWebRequest.cs (Close): Move the code that accumulates the
+	output to Close from Flush.  Flush could have been called in the
+	middle of the processing, and would have generated invalid results
+	(which it did).
+
 2003-05-23  Zoltan Varga  <[email protected]>
 
 	* Dns.cs (GetHostByAddress): Return the local host when called with

+ 14 - 16
mcs/class/System/System.Net/HttpWebRequest.cs

@@ -732,21 +732,8 @@ namespace System.Net
 
 			public override void Flush ()
 			{
-				if (AccumulateOutput == null){
+				if (AccumulateOutput == null)
 					base.Flush ();
-					return;
-				}
-				ArrayList output = AccumulateOutput;
-				AccumulateOutput = null;
-				long size = 0;
-				foreach (byte [] b in output)
-					size += b.Length;
-				WriteHeaders (size, true);
-				foreach (byte [] b in output)
-					base.Write (b, 0, b.Length);
-
-				AccumulateOutput = null;
-				base.Flush ();
 			}
 
 			protected override void Dispose (bool disposing)
@@ -774,8 +761,19 @@ namespace System.Net
 			public override void Close() 
 			{
 
-				if (AccumulateOutput != null)
-					Flush ();
+				if (AccumulateOutput != null){
+					ArrayList output = AccumulateOutput;
+					AccumulateOutput = null;
+					long size = 0;
+					foreach (byte [] b in output)
+						size += b.Length;
+					WriteHeaders (size, true);
+					foreach (byte [] b in output){
+						base.Write (b, 0, b.Length);
+					}
+					AccumulateOutput = null;
+					base.Flush ();
+				}
 					       
 				GC.SuppressFinalize (this);
 				Dispose (true);