// Constructors static WebRequest () { if (Platform.IsMacOS) { #if MONOTOUCH Type type = Type.GetType ("MonoTouch.CoreFoundation.CFNetwork, monotouch"); #else Type type = Type.GetType ("MonoMac.CoreFoundation.CFNetwork, monomac"); #endif if (type != null) cfGetDefaultProxy = type.GetMethod ("GetDefaultProxy"); } #if NET_2_1 IWebRequestCreate http = new HttpRequestCreator (); RegisterPrefix ("http", http); RegisterPrefix ("https", http); #if MOBILE RegisterPrefix ("file", new FileWebRequestCreator ()); RegisterPrefix ("ftp", new FtpRequestCreator ()); #endif #else defaultCachePolicy = new HttpRequestCachePolicy (HttpRequestCacheLevel.NoCacheNoStore); #if CONFIGURATION_DEP object cfg = ConfigurationManager.GetSection ("system.net/webRequestModules"); WebRequestModulesSection s = cfg as WebRequestModulesSection; if (s != null) { foreach (WebRequestModuleElement el in s.WebRequestModules) AddPrefix (el.Prefix, el.Type); return; } #endif ConfigurationSettings.GetConfig ("system.net/webRequestModules"); #endif }
// Constructors static WebRequest () { #if NET_2_1 IWebRequestCreate http = new HttpRequestCreator (); RegisterPrefix ("http", http); RegisterPrefix ("https", http); #if MOBILE RegisterPrefix ("file", new FileWebRequestCreator ()); RegisterPrefix ("ftp", new FtpRequestCreator ()); #endif #else defaultCachePolicy = new HttpRequestCachePolicy (HttpRequestCacheLevel.NoCacheNoStore); #if CONFIGURATION_DEP object cfg = ConfigurationManager.GetSection ("system.net/webRequestModules"); WebRequestModulesSection s = cfg as WebRequestModulesSection; if (s != null) { foreach (WebRequestModuleElement el in s.WebRequestModules) AddPrefix (el.Prefix, el.Type); return; } #endif ConfigurationSettings.GetConfig ("system.net/webRequestModules"); #endif }
static WebRequest() { #if MOBILE IWebRequestCreate http = new HttpRequestCreator(); RegisterPrefix("http", http); RegisterPrefix("https", http); RegisterPrefix("file", new FileWebRequestCreator()); RegisterPrefix("ftp", new FtpRequestCreator()); #else #if CONFIGURATION_DEP object cfg = ConfigurationManager.GetSection("system.net/webRequestModules"); WebRequestModulesSection s = cfg as WebRequestModulesSection; if (s != null) { foreach (WebRequestModuleElement el in s.WebRequestModules) { AddPrefix(el.Prefix, el.Type); } return; } #endif ConfigurationSettings.GetConfig("system.net/webRequestModules"); #endif }
// Constructors static WebRequest() { if (Platform.IsMacOS) { #if MONOTOUCH Type type = Type.GetType("MonoTouch.CoreFoundation.CFNetwork, monotouch"); #else Type type = Type.GetType("MonoMac.CoreFoundation.CFNetwork, monomac"); #endif if (type != null) { cfGetDefaultProxy = type.GetMethod("GetDefaultProxy"); } } #if NET_2_1 IWebRequestCreate http = new HttpRequestCreator(); RegisterPrefix("http", http); RegisterPrefix("https", http); #if MOBILE RegisterPrefix("file", new FileWebRequestCreator()); RegisterPrefix("ftp", new FtpRequestCreator()); #endif #else #if NET_2_0 defaultCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore); #endif #if NET_2_0 && CONFIGURATION_DEP object cfg = ConfigurationManager.GetSection("system.net/webRequestModules"); WebRequestModulesSection s = cfg as WebRequestModulesSection; if (s != null) { foreach (WebRequestModuleElement el in s.WebRequestModules) { AddPrefix(el.Prefix, el.Type); } return; } #endif ConfigurationSettings.GetConfig("system.net/webRequestModules"); #endif }
static ArrayList PopulatePrefixList() { var res = new ArrayList(); #if MOBILE || !CONFIGURATION_DEP IWebRequestCreate http = new HttpRequestCreator(); res.Add(new WebRequestPrefixElement("http", http)); res.Add(new WebRequestPrefixElement("https", http)); res.Add(new WebRequestPrefixElement("file", new FileWebRequestCreator())); res.Add(new WebRequestPrefixElement("ftp", new FtpRequestCreator())); #else object cfg = ConfigurationManager.GetSection("system.net/webRequestModules"); WebRequestModulesSection s = cfg as WebRequestModulesSection; if (s != null) { foreach (WebRequestModuleElement el in s.WebRequestModules) { res.Add(new WebRequestPrefixElement(el.Prefix, el.Type)); } } #endif return(res); }
/// <summary> /// Registers <itemref>HttpRequestCreator</itemref> as the creator for the "http" prefix. /// </summary> static HttpWebRequest() { // Creates instance of HttpRequestCreator. HttpRequestCreator creates HttpWebRequest HttpRequestCreator Creator = new HttpRequestCreator(); // Register prefix. HttpWebRequest handles both http and https RegisterPrefix("http:", Creator); RegisterPrefix("https:", Creator); if (m_ConnectedStreams == null) { // Creates new list for connected sockets. m_ConnectedStreams = new ArrayList(); m_DropOldConnectionsTimer = new Timer(CheckPersistentConnections, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); } }
static ArrayList PopulatePrefixList () { var res = new ArrayList(); #if MOBILE || !CONFIGURATION_DEP IWebRequestCreate http = new HttpRequestCreator (); res.Add(new WebRequestPrefixElement("http", http)); res.Add(new WebRequestPrefixElement("https", http)); res.Add(new WebRequestPrefixElement("file", new FileWebRequestCreator ())); res.Add(new WebRequestPrefixElement("ftp", new FtpRequestCreator ())); #else object cfg = ConfigurationManager.GetSection ("system.net/webRequestModules"); WebRequestModulesSection s = cfg as WebRequestModulesSection; if (s != null) { foreach (WebRequestModuleElement el in s.WebRequestModules) res.Add (new WebRequestPrefixElement(el.Prefix, el.Type)); } #endif return res; }