Преглед изворни кода

* HttpWebRequest.cs: Allow Proxy to be set to null on 2.0 profile.
* HttpWebRequestTest.cs: Added test for bug #80944.

svn path=/trunk/mcs/; revision=73389

Gert Driesen пре 19 година
родитељ
комит
464075aff1

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

@@ -1,3 +1,7 @@
+2007-02-24  Gert Driesen  <[email protected]>
+
+	* HttpWebRequest.cs: Allow Proxy to be set to null on 2.0 profile.
+
 2007-02-18  Geoff Norton  <[email protected]>
 
 	* AuthenticationManager.cs: Register the modules in the 2.0 profile

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

@@ -400,8 +400,10 @@ namespace System.Net
 			get { return proxy; }
 			set { 
 				CheckRequestStarted ();
+#if ONLY_1_1
 				if (value == null)
 					throw new ArgumentNullException ("value");
+#endif
 
 				proxy = value;
 				servicePoint = null; // we may need a new one

+ 4 - 0
mcs/class/System/Test/System.Net/ChangeLog

@@ -1,3 +1,7 @@
+2007-02-24  Gert Driesen  <[email protected]>
+
+	* HttpWebRequestTest.cs: Added test for bug #80944.
+
 2007-02-08  Ilya Kharmatsky <ilyak -at- mainsoft.com>
 
 	* FileWebRequestTest.cs: Excluded not working under TARGET_JVM

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

@@ -32,6 +32,28 @@ namespace MonoTests.System.Net
 	[TestFixture]
 	public class HttpWebRequestTest
 	{
+		[Test]
+		public void Proxy_Null ()
+		{
+			HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
+			Assert.IsNotNull (req.Proxy, "#1");
+#if NET_2_0
+			req.Proxy = null;
+			Assert.IsNull (req.Proxy, "#2");
+#else
+			try {
+				req.Proxy = null;
+				Assert.Fail ("#2");
+			} catch (ArgumentNullException ex) {
+				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#3");
+				Assert.IsNull (ex.InnerException, "#4");
+				Assert.IsNotNull (ex.Message, "#5");
+				Assert.IsNotNull (ex.ParamName, "#6");
+				Assert.AreEqual ("value", ex.ParamName, "#7");
+			}
+#endif
+		}
+
 		[Test]
 		[Category("InetAccess")] 
 #if TARGET_JVM