Przeglądaj źródła

[system] Fixes HttpWebRequest::AllowReadStreamBuffering

Marek Safar 11 lat temu
rodzic
commit
cd3707a51f

+ 5 - 2
mcs/class/System/System.Net/HttpWebRequest.cs

@@ -202,8 +202,11 @@ namespace System.Net
 		
 #if NET_4_5
 		public virtual bool AllowReadStreamBuffering {
-			get { return allowBuffering; }
-			set { allowBuffering = value; }
+			get { return false; }
+			set {
+				if (value)
+					throw new InvalidOperationException ();
+			}
 		}
 #endif
 

+ 13 - 0
mcs/class/System/Test/System.Net/HttpWebRequestTest.cs

@@ -2495,6 +2495,19 @@ namespace MonoTests.System.Net
 		}
 #endif
 
+#if NET_4_5
+		[Test]
+		public void AllowReadStreamBuffering ()
+		{
+			var hr = WebRequest.CreateHttp ("http://www.google.com");
+			Assert.IsFalse (hr.AllowReadStreamBuffering, "#1");
+			try {
+				hr.AllowReadStreamBuffering = true;
+				Assert.Fail ("#2");
+			} catch (InvalidOperationException) {
+			}
+		}
+#endif
 
 		class ListenerScope : IDisposable {
 			EventWaitHandle completed;