Merge pull request #2171 from lambdageek/dev/fix-marshal
[mono.git] / mcs / class / System / System.Net / GlobalProxySelection.cs
index d17683ced5ba4d5d7f8851d72e79a1b49b8f1fb0..049f61ccad047c2331a06cc0ef2148213cb88bb9 100644 (file)
@@ -1,74 +1,83 @@
-//\r
-// System.Net.GlobalProxySelection\r
-//\r
-// Author:\r
-//   Lawrence Pit (loz@cable.a2000.nl)\r
-//\r
-\r
-using System;\r
-using System.Collections;\r
-using System.IO;\r
-using System.Runtime.Serialization;\r
-\r
-namespace System.Net \r
-{\r
-       public class GlobalProxySelection\r
-       {\r
-               private static IWebProxy proxy;\r
-               \r
-               // Static Initializer\r
-               \r
-               static GlobalProxySelection ()\r
-               {\r
-                       proxy = GetEmptyWebProxy ();\r
-                       \r
-                       // TODO: create proxy object based on information from\r
-                       //       the global or application configuration file.\r
-               }\r
-               \r
-               // Constructors\r
-               \r
-               public GlobalProxySelection() { }\r
-               \r
-               // Properties\r
-               \r
-               public static IWebProxy Select {\r
-                       get { return proxy; }\r
-                       set { \r
-                               proxy = (value == null) ? GetEmptyWebProxy () : value; \r
-                       }\r
-               }\r
-               \r
-               // Methods\r
-               \r
-               public static IWebProxy GetEmptyWebProxy()\r
-               {\r
-                       // must return a new one each time, as the credentials\r
-                       // can be set\r
-                       return new EmptyWebProxy ();    \r
-               }\r
-               \r
-               // Internal Classes\r
-               \r
-               internal class EmptyWebProxy : IWebProxy {\r
-                       private ICredentials credentials = null;\r
-                       \r
-                       internal EmptyWebProxy () { }\r
-                       \r
-                       public ICredentials Credentials {\r
-                               get { return credentials; } \r
-                               set { credentials = value; }\r
-                       }\r
-\r
-                       public Uri GetProxy (Uri destination)\r
-                       {\r
-                               return destination;\r
-                       }\r
-\r
-                       public bool IsBypassed (Uri host)\r
-                       {\r
-                               return true; // pass directly to host\r
-                       }\r
-               }\r
-       }               \r
-}
\ No newline at end of file
+//
+// System.Net.GlobalProxySelection
+//
+// Author:
+//   Lawrence Pit (loz@cable.a2000.nl)
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+using System.Configuration;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Net.Configuration;
+
+namespace System.Net 
+{
+       [ObsoleteAttribute("Use WebRequest.DefaultProxy instead")]
+       public class GlobalProxySelection
+       {
+               // Constructors
+               public GlobalProxySelection() { }
+               
+               // Properties
+
+               public static IWebProxy Select {
+                       get { return WebRequest.DefaultWebProxy; }
+                       set { WebRequest.DefaultWebProxy = value; }
+               }
+               
+               // Methods
+               
+               public static IWebProxy GetEmptyWebProxy()
+               {
+                       // must return a new one each time, as the credentials
+                       // can be set
+                       return new EmptyWebProxy ();    
+               }
+               
+               // Internal Classes
+               
+               internal class EmptyWebProxy : IWebProxy {
+                       private ICredentials credentials = null;
+                       
+                       internal EmptyWebProxy () { }
+                       
+                       public ICredentials Credentials {
+                               get { return credentials; } 
+                               set { credentials = value; }
+                       }
+
+                       public Uri GetProxy (Uri destination)
+                       {
+                               return destination;
+                       }
+
+                       public bool IsBypassed (Uri host)
+                       {
+                               return true; // pass directly to host
+                       }
+               }
+       }               
+}