mscorlib(4.0.0.0) API with additions
ServicePointManager.cs
1 using System.Collections;
2 using System.Diagnostics;
5 using System.Net.Security;
8 using System.Threading;
9 
10 namespace System.Net
11 {
13  public class ServicePointManager
14  {
17 
19  public const int DefaultPersistentConnectionLimit = 2;
20 
21  private const int DefaultAspPersistentConnectionLimit = 10;
22 
23  internal static readonly string SpecialConnectGroupName = "/.NET/NetClasses/HttpWebRequest/CONNECT__Group$$/";
24 
25  internal static readonly TimerThread.Callback s_IdleServicePointTimeoutDelegate = IdleServicePointTimeoutCallback;
26 
27  private static Hashtable s_ServicePointTable = new Hashtable(10);
28 
29  private static volatile TimerThread.Queue s_ServicePointIdlingQueue = TimerThread.GetOrCreateQueue(100000);
30 
31  private static int s_MaxServicePoints = 0;
32 
33  private static volatile CertPolicyValidationCallback s_CertPolicyValidationCallback = new CertPolicyValidationCallback();
34 
35  private static volatile ServerCertValidationCallback s_ServerCertValidationCallback = null;
36 
37  private static SecurityProtocolType s_SecurityProtocolType;
38 
39  private static bool s_reusePort;
40 
41  private static bool? s_reusePortSupported = null;
42 
43  private static bool s_disableStrongCrypto;
44 
45  private static bool s_disableSendAuxRecord;
46 
47  private static bool s_disableSystemDefaultTlsVersions;
48 
49  private static SslProtocols s_defaultSslProtocols;
50 
51  private static bool s_disableCertificateEKUs;
52 
53  private static volatile Hashtable s_ConfigTable = null;
54 
55  private static volatile int s_ConnectionLimit = PersistentConnectionLimit;
56 
57  internal static volatile bool s_UseTcpKeepAlive = false;
58 
59  internal static volatile int s_TcpKeepAliveTime;
60 
61  internal static volatile int s_TcpKeepAliveInterval;
62 
63  private static volatile bool s_UserChangedLimit;
64 
65  private static object s_configurationLoadedLock = new object();
66 
67  private static volatile bool s_configurationLoaded = false;
68 
69  private const string RegistryGlobalStrongCryptoName = "SchUseStrongCrypto";
70 
71  private const string RegistryGlobalReusePortName = "HWRPortReuseOnSocketBind";
72 
73  private const string RegistryGlobalSendAuxRecordName = "SchSendAuxRecord";
74 
75  private const string RegistryLocalSendAuxRecordName = "System.Net.ServicePointManager.SchSendAuxRecord";
76 
77  private const string RegistryGlobalSystemDefaultTlsVersionsName = "SystemDefaultTlsVersions";
78 
79  private const string RegistryLocalSystemDefaultTlsVersionsName = "System.Net.ServicePointManager.SystemDefaultTlsVersions";
80 
81  private const string RegistryLocalSecureProtocolName = "System.Net.ServicePointManager.SecurityProtocol";
82 
83  private const string RegistryGlobalRequireCertificateEKUs = "RequireCertificateEKUs";
84 
85  private const string RegistryLocalRequireCertificateEKUs = "System.Net.ServicePointManager.RequireCertificateEKUs";
86 
87  private static int InternalConnectionLimit
88  {
89  get
90  {
91  if (s_ConfigTable == null)
92  {
93  s_ConfigTable = ConfigTable;
94  }
95  return s_ConnectionLimit;
96  }
97  set
98  {
99  if (s_ConfigTable == null)
100  {
101  s_ConfigTable = ConfigTable;
102  }
103  s_UserChangedLimit = true;
104  s_ConnectionLimit = value;
105  }
106  }
107 
108  private static int PersistentConnectionLimit
109  {
110  get
111  {
112  if (ComNetOS.IsAspNetServer)
113  {
114  return 10;
115  }
116  return 2;
117  }
118  }
119 
120  private static Hashtable ConfigTable
121  {
122  get
123  {
124  if (s_ConfigTable == null)
125  {
126  lock (s_ServicePointTable)
127  {
128  if (s_ConfigTable == null)
129  {
130  ConnectionManagementSectionInternal section = ConnectionManagementSectionInternal.GetSection();
131  Hashtable hashtable = null;
132  if (section != null)
133  {
134  hashtable = section.ConnectionManagement;
135  }
136  if (hashtable == null)
137  {
138  hashtable = new Hashtable();
139  }
140  if (hashtable.ContainsKey("*"))
141  {
142  int num = (int)hashtable["*"];
143  if (num < 1)
144  {
145  num = PersistentConnectionLimit;
146  }
147  s_ConnectionLimit = num;
148  }
149  s_ConfigTable = hashtable;
150  }
151  }
152  }
153  return s_ConfigTable;
154  }
155  }
156 
157  internal static TimerThread.Callback IdleServicePointTimeoutDelegate => s_IdleServicePointTimeoutDelegate;
158 
163  {
164  get
165  {
166  EnsureConfigurationLoaded();
167  return s_SecurityProtocolType;
168  }
169  set
170  {
171  EnsureConfigurationLoaded();
172  ValidateSecurityProtocol(value);
173  s_SecurityProtocolType = value;
174  }
175  }
176 
177  internal static bool DisableStrongCrypto
178  {
179  get
180  {
181  EnsureConfigurationLoaded();
182  return s_disableStrongCrypto;
183  }
184  }
185 
186  internal static bool DisableSystemDefaultTlsVersions
187  {
188  get
189  {
190  EnsureConfigurationLoaded();
191  return s_disableSystemDefaultTlsVersions;
192  }
193  }
194 
195  internal static bool DisableSendAuxRecord
196  {
197  get
198  {
199  EnsureConfigurationLoaded();
200  return s_disableSendAuxRecord;
201  }
202  }
203 
204  internal static bool DisableCertificateEKUs
205  {
206  get
207  {
208  EnsureConfigurationLoaded();
209  return s_disableCertificateEKUs;
210  }
211  }
212 
213  internal static SslProtocols DefaultSslProtocols
214  {
215  get
216  {
217  EnsureConfigurationLoaded();
218  return s_defaultSslProtocols;
219  }
220  }
221 
226  public static int MaxServicePoints
227  {
228  get
229  {
230  return s_MaxServicePoints;
231  }
232  set
233  {
234  ExceptionHelper.WebPermissionUnrestricted.Demand();
235  if (!ValidationHelper.ValidateRange(value, 0, int.MaxValue))
236  {
237  throw new ArgumentOutOfRangeException("value");
238  }
239  s_MaxServicePoints = value;
240  }
241  }
242 
247  public static int DefaultConnectionLimit
248  {
249  get
250  {
251  return InternalConnectionLimit;
252  }
253  set
254  {
255  ExceptionHelper.WebPermissionUnrestricted.Demand();
256  if (value > 0)
257  {
258  InternalConnectionLimit = value;
259  return;
260  }
261  throw new ArgumentOutOfRangeException("value", SR.GetString("net_toosmall"));
262  }
263  }
264 
269  public static int MaxServicePointIdleTime
270  {
271  get
272  {
273  return s_ServicePointIdlingQueue.Duration;
274  }
275  set
276  {
277  ExceptionHelper.WebPermissionUnrestricted.Demand();
278  if (!ValidationHelper.ValidateRange(value, -1, int.MaxValue))
279  {
280  throw new ArgumentOutOfRangeException("value");
281  }
282  if (s_ServicePointIdlingQueue.Duration != value)
283  {
284  s_ServicePointIdlingQueue = TimerThread.GetOrCreateQueue(value);
285  }
286  }
287  }
288 
292  public static bool UseNagleAlgorithm
293  {
294  get
295  {
296  return SettingsSectionInternal.Section.UseNagleAlgorithm;
297  }
298  set
299  {
300  SettingsSectionInternal.Section.UseNagleAlgorithm = value;
301  }
302  }
303 
307  public static bool Expect100Continue
308  {
309  get
310  {
311  return SettingsSectionInternal.Section.Expect100Continue;
312  }
313  set
314  {
315  SettingsSectionInternal.Section.Expect100Continue = value;
316  }
317  }
318 
322  public static bool EnableDnsRoundRobin
323  {
324  get
325  {
326  return SettingsSectionInternal.Section.EnableDnsRoundRobin;
327  }
328  set
329  {
330  SettingsSectionInternal.Section.EnableDnsRoundRobin = value;
331  }
332  }
333 
336  public static int DnsRefreshTimeout
337  {
338  get
339  {
340  return SettingsSectionInternal.Section.DnsRefreshTimeout;
341  }
342  set
343  {
344  if (value < -1)
345  {
346  SettingsSectionInternal.Section.DnsRefreshTimeout = -1;
347  }
348  else
349  {
350  SettingsSectionInternal.Section.DnsRefreshTimeout = value;
351  }
352  }
353  }
354 
357  [Obsolete("CertificatePolicy is obsoleted for this type, please use ServerCertificateValidationCallback instead. http://go.microsoft.com/fwlink/?linkid=14202")]
359  {
360  get
361  {
362  return GetLegacyCertificatePolicy();
363  }
364  set
365  {
366  ExceptionHelper.UnmanagedPermission.Demand();
367  s_CertPolicyValidationCallback = new CertPolicyValidationCallback(value);
368  }
369  }
370 
371  internal static CertPolicyValidationCallback CertPolicyValidationCallback => s_CertPolicyValidationCallback;
372 
376  {
377  get
378  {
379  if (s_ServerCertValidationCallback == null)
380  {
381  return null;
382  }
383  return s_ServerCertValidationCallback.ValidationCallback;
384  }
385  set
386  {
387  ExceptionHelper.InfrastructurePermission.Demand();
388  if (value == null)
389  {
390  s_ServerCertValidationCallback = null;
391  }
392  else
393  {
394  s_ServerCertValidationCallback = new ServerCertValidationCallback(value);
395  }
396  }
397  }
398 
399  internal static ServerCertValidationCallback ServerCertValidationCallback => s_ServerCertValidationCallback;
400 
403  public static bool ReusePort
404  {
405  get
406  {
407  return s_reusePort;
408  }
409  set
410  {
411  s_reusePort = value;
412  }
413  }
414 
415  internal static bool? ReusePortSupported
416  {
417  get
418  {
419  return s_reusePortSupported;
420  }
421  set
422  {
423  s_reusePortSupported = value;
424  }
425  }
426 
430  public static bool CheckCertificateRevocationList
431  {
432  get
433  {
434  return SettingsSectionInternal.Section.CheckCertificateRevocationList;
435  }
436  set
437  {
438  ExceptionHelper.UnmanagedPermission.Demand();
439  SettingsSectionInternal.Section.CheckCertificateRevocationList = value;
440  }
441  }
442 
445  public static EncryptionPolicy EncryptionPolicy => SettingsSectionInternal.Section.EncryptionPolicy;
446 
447  internal static bool CheckCertificateName => SettingsSectionInternal.Section.CheckCertificateName;
448 
449  [Conditional("DEBUG")]
450  internal static void DebugMembers(int requestHash)
451  {
452  try
453  {
454  foreach (WeakReference item in s_ServicePointTable)
455  {
456  ServicePoint servicePoint = (item == null || !item.IsAlive) ? null : ((ServicePoint)item.Target);
457  }
458  }
459  catch (Exception ex)
460  {
462  {
463  throw;
464  }
465  }
466  }
467 
468  private static void IdleServicePointTimeoutCallback(TimerThread.Timer timer, int timeNoticed, object context)
469  {
470  ServicePoint servicePoint = (ServicePoint)context;
471  if (Logging.On)
472  {
473  Logging.PrintInfo(Logging.Web, SR.GetString("net_log_closed_idle", "ServicePoint", servicePoint.GetHashCode()));
474  }
475  lock (s_ServicePointTable)
476  {
477  s_ServicePointTable.Remove(servicePoint.LookupString);
478  }
479  servicePoint.ReleaseAllConnectionGroups();
480  }
481 
482  private ServicePointManager()
483  {
484  }
485 
486  private static void ValidateSecurityProtocol(SecurityProtocolType value)
487  {
489  if ((value & ~securityProtocolType) != 0)
490  {
491  throw new NotSupportedException(SR.GetString("net_securityprotocolnotsupported"));
492  }
493  }
494 
495  internal static ICertificatePolicy GetLegacyCertificatePolicy()
496  {
497  if (s_CertPolicyValidationCallback == null)
498  {
499  return null;
500  }
501  return s_CertPolicyValidationCallback.CertificatePolicy;
502  }
503 
504  internal static string MakeQueryString(Uri address)
505  {
506  if (address.IsDefaultPort)
507  {
508  return address.Scheme + "://" + address.DnsSafeHost;
509  }
510  return address.Scheme + "://" + address.DnsSafeHost + ":" + address.Port.ToString();
511  }
512 
513  internal static string MakeQueryString(Uri address1, bool isProxy)
514  {
515  if (isProxy)
516  {
517  return MakeQueryString(address1) + "://proxy";
518  }
519  return MakeQueryString(address1);
520  }
521 
528  public static ServicePoint FindServicePoint(Uri address)
529  {
530  return FindServicePoint(address, null);
531  }
532 
539  public static ServicePoint FindServicePoint(string uriString, IWebProxy proxy)
540  {
541  Uri address = new Uri(uriString);
542  return FindServicePoint(address, proxy);
543  }
544 
552  public static ServicePoint FindServicePoint(Uri address, IWebProxy proxy)
553  {
554  HttpAbortDelegate abortDelegate = null;
555  int abortState = 0;
556  ProxyChain chain;
557  return FindServicePoint(address, proxy, out chain, ref abortDelegate, ref abortState);
558  }
559 
560  internal static ServicePoint FindServicePoint(Uri address, IWebProxy proxy, out ProxyChain chain, ref HttpAbortDelegate abortDelegate, ref int abortState)
561  {
562  if (address == null)
563  {
564  throw new ArgumentNullException("address");
565  }
566  bool isProxyServicePoint = false;
567  chain = null;
568  Uri uri = null;
569  if (proxy != null && !address.IsLoopback)
570  {
571  IAutoWebProxy autoWebProxy = proxy as IAutoWebProxy;
572  if (autoWebProxy != null)
573  {
574  chain = autoWebProxy.GetProxies(address);
575  abortDelegate = chain.HttpAbortDelegate;
576  try
577  {
579  if (abortState != 0)
580  {
581  Exception ex = new WebException(NetRes.GetWebStatusString(WebExceptionStatus.RequestCanceled), WebExceptionStatus.RequestCanceled);
582  throw ex;
583  }
584  chain.Enumerator.MoveNext();
585  uri = chain.Enumerator.Current;
586  }
587  finally
588  {
589  abortDelegate = null;
590  }
591  }
592  else if (!proxy.IsBypassed(address))
593  {
594  uri = proxy.GetProxy(address);
595  }
596  if (uri != null)
597  {
598  address = uri;
599  isProxyServicePoint = true;
600  }
601  }
602  return FindServicePointHelper(address, isProxyServicePoint);
603  }
604 
605  internal static ServicePoint FindServicePoint(ProxyChain chain)
606  {
607  if (!chain.Enumerator.MoveNext())
608  {
609  return null;
610  }
611  Uri current = chain.Enumerator.Current;
612  return FindServicePointHelper((current == null) ? chain.Destination : current, current != null);
613  }
614 
615  private static ServicePoint FindServicePointHelper(Uri address, bool isProxyServicePoint)
616  {
617  if (isProxyServicePoint && address.Scheme != Uri.UriSchemeHttp)
618  {
619  Exception ex = new NotSupportedException(SR.GetString("net_proxyschemenotsupported", address.Scheme));
620  throw ex;
621  }
622  string text = MakeQueryString(address, isProxyServicePoint);
623  ServicePoint servicePoint = null;
624  lock (s_ServicePointTable)
625  {
626  WeakReference weakReference = s_ServicePointTable[text] as WeakReference;
627  if (weakReference != null)
628  {
629  servicePoint = (ServicePoint)weakReference.Target;
630  }
631  if (servicePoint != null)
632  {
633  return servicePoint;
634  }
635  if (s_MaxServicePoints > 0 && s_ServicePointTable.Count >= s_MaxServicePoints)
636  {
637  Exception ex2 = new InvalidOperationException(SR.GetString("net_maxsrvpoints"));
638  throw ex2;
639  }
640  int defaultConnectionLimit = InternalConnectionLimit;
641  string key = MakeQueryString(address);
642  bool userChangedLimit = s_UserChangedLimit;
643  if (ConfigTable.ContainsKey(key))
644  {
645  defaultConnectionLimit = (int)ConfigTable[key];
646  userChangedLimit = true;
647  }
648  servicePoint = new ServicePoint(address, s_ServicePointIdlingQueue, defaultConnectionLimit, text, userChangedLimit, isProxyServicePoint);
649  weakReference = new WeakReference(servicePoint);
650  s_ServicePointTable[text] = weakReference;
651  return servicePoint;
652  }
653  }
654 
655  internal static ServicePoint FindServicePoint(string host, int port)
656  {
657  if (host == null)
658  {
659  throw new ArgumentNullException("address");
660  }
661  string text = null;
662  bool proxyServicePoint = false;
663  text = "ByHost:" + host + ":" + port.ToString(CultureInfo.InvariantCulture);
664  ServicePoint servicePoint = null;
665  lock (s_ServicePointTable)
666  {
667  WeakReference weakReference = s_ServicePointTable[text] as WeakReference;
668  if (weakReference != null)
669  {
670  servicePoint = (ServicePoint)weakReference.Target;
671  }
672  if (servicePoint != null)
673  {
674  return servicePoint;
675  }
676  if (s_MaxServicePoints > 0 && s_ServicePointTable.Count >= s_MaxServicePoints)
677  {
678  Exception ex = new InvalidOperationException(SR.GetString("net_maxsrvpoints"));
679  throw ex;
680  }
681  int defaultConnectionLimit = InternalConnectionLimit;
682  bool userChangedLimit = s_UserChangedLimit;
683  string key = host + ":" + port.ToString(CultureInfo.InvariantCulture);
684  if (ConfigTable.ContainsKey(key))
685  {
686  defaultConnectionLimit = (int)ConfigTable[key];
687  userChangedLimit = true;
688  }
689  servicePoint = new ServicePoint(host, port, s_ServicePointIdlingQueue, defaultConnectionLimit, text, userChangedLimit, proxyServicePoint);
690  weakReference = new WeakReference(servicePoint);
691  s_ServicePointTable[text] = weakReference;
692  return servicePoint;
693  }
694  }
695 
696  [FriendAccessAllowed]
697  internal static void CloseConnectionGroups(string connectionGroupName)
698  {
699  ServicePoint servicePoint = null;
700  lock (s_ServicePointTable)
701  {
702  foreach (DictionaryEntry item in s_ServicePointTable)
703  {
704  WeakReference weakReference = item.Value as WeakReference;
705  if (weakReference != null)
706  {
707  ((ServicePoint)weakReference.Target)?.CloseConnectionGroupInternal(connectionGroupName);
708  }
709  }
710  }
711  }
712 
718  public static void SetTcpKeepAlive(bool enabled, int keepAliveTime, int keepAliveInterval)
719  {
720  if (enabled)
721  {
722  s_UseTcpKeepAlive = true;
723  if (keepAliveTime <= 0)
724  {
725  throw new ArgumentOutOfRangeException("keepAliveTime");
726  }
727  if (keepAliveInterval <= 0)
728  {
729  throw new ArgumentOutOfRangeException("keepAliveInterval");
730  }
731  s_TcpKeepAliveTime = keepAliveTime;
732  s_TcpKeepAliveInterval = keepAliveInterval;
733  }
734  else
735  {
736  s_UseTcpKeepAlive = false;
737  s_TcpKeepAliveTime = 0;
738  s_TcpKeepAliveInterval = 0;
739  }
740  }
741 
742  private static void LoadConfiguration()
743  {
744  s_reusePort = TryInitialize(LoadReusePortConfiguration, fallbackDefault: false);
745  s_disableStrongCrypto = TryInitialize(LoadDisableStrongCryptoConfiguration, fallbackDefault: true);
746  s_disableSendAuxRecord = TryInitialize(LoadDisableSendAuxRecordConfiguration, fallbackDefault: false);
747  s_disableSystemDefaultTlsVersions = TryInitialize(LoadDisableSystemDefaultTlsVersionsConfiguration, fallbackDefault: true);
748  s_disableCertificateEKUs = TryInitialize(LoadDisableCertificateEKUsConfiguration, fallbackDefault: false);
749  s_defaultSslProtocols = TryInitialize(LoadSecureProtocolConfiguration, SslProtocols.Default);
750  s_SecurityProtocolType = (SecurityProtocolType)s_defaultSslProtocols;
751  }
752 
753  private static bool LoadDisableStrongCryptoConfiguration(bool disable)
754  {
755  int num = 0;
756  if (System.LocalAppContextSwitches.DontEnableSchUseStrongCrypto)
757  {
758  num = RegistryConfiguration.GlobalConfigReadInt("SchUseStrongCrypto", 0);
759  disable = (num != 1);
760  }
761  else
762  {
763  num = RegistryConfiguration.GlobalConfigReadInt("SchUseStrongCrypto", 1);
764  disable = (num == 0);
765  }
766  return disable;
767  }
768 
769  private static bool LoadDisableSendAuxRecordConfiguration(bool disable)
770  {
771  if (RegistryConfiguration.AppConfigReadInt("System.Net.ServicePointManager.SchSendAuxRecord", 1) == 0)
772  {
773  return true;
774  }
775  if (RegistryConfiguration.GlobalConfigReadInt("SchSendAuxRecord", 1) == 0)
776  {
777  return true;
778  }
779  return disable;
780  }
781 
782  private static bool LoadDisableSystemDefaultTlsVersionsConfiguration(bool disable)
783  {
784  if (System.LocalAppContextSwitches.DontEnableSystemDefaultTlsVersions)
785  {
786  int num = RegistryConfiguration.GlobalConfigReadInt("SystemDefaultTlsVersions", 0);
787  disable = (num != 1);
788  }
789  else
790  {
791  int num2 = RegistryConfiguration.GlobalConfigReadInt("SystemDefaultTlsVersions", 1);
792  disable = (num2 == 0);
793  }
794  if (!disable)
795  {
796  int num3 = RegistryConfiguration.AppConfigReadInt("System.Net.ServicePointManager.SystemDefaultTlsVersions", 1);
797  disable = (num3 != 1);
798  }
799  return disable;
800  }
801 
802  private static SslProtocols LoadSecureProtocolConfiguration(SslProtocols defaultValue)
803  {
804  defaultValue = (s_disableSystemDefaultTlsVersions ? (s_disableStrongCrypto ? SslProtocols.Default : (SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12)) : SslProtocols.None);
805  if (!s_disableStrongCrypto || !s_disableSystemDefaultTlsVersions)
806  {
807  string value = RegistryConfiguration.AppConfigReadString("System.Net.ServicePointManager.SecurityProtocol", null);
808  if (Enum.TryParse(value, out SecurityProtocolType result))
809  {
810  ValidateSecurityProtocol(result);
811  defaultValue = (SslProtocols)result;
812  }
813  }
814  return defaultValue;
815  }
816 
817  private static bool LoadReusePortConfiguration(bool reusePortInternal)
818  {
819  int num = 0;
820  num = RegistryConfiguration.GlobalConfigReadInt("HWRPortReuseOnSocketBind", 0);
821  if (num == 1)
822  {
823  if (Logging.On)
824  {
825  Logging.PrintInfo(Logging.Web, typeof(ServicePointManager), SR.GetString("net_log_set_socketoption_reuseport_default_on"));
826  }
827  reusePortInternal = true;
828  }
829  return reusePortInternal;
830  }
831 
832  private static bool LoadDisableCertificateEKUsConfiguration(bool disable)
833  {
834  if (System.LocalAppContextSwitches.DontCheckCertificateEKUs)
835  {
836  return true;
837  }
838  if (RegistryConfiguration.AppConfigReadInt("System.Net.ServicePointManager.RequireCertificateEKUs", 1) == 0)
839  {
840  return true;
841  }
842  if (RegistryConfiguration.GlobalConfigReadInt("RequireCertificateEKUs", 1) == 0)
843  {
844  return true;
845  }
846  return disable;
847  }
848 
849  private static void EnsureConfigurationLoaded()
850  {
851  if (!s_configurationLoaded)
852  {
853  lock (s_configurationLoadedLock)
854  {
855  if (!s_configurationLoaded)
856  {
857  LoadConfiguration();
858  s_configurationLoaded = true;
859  }
860  }
861  }
862  }
863 
864  private static T TryInitialize<T>(Func<T, T> loadConfiguration, T fallbackDefault)
865  {
866  try
867  {
868  return loadConfiguration(fallbackDefault);
869  }
870  catch (Exception exception)
871  {
872  if (NclUtilities.IsFatal(exception))
873  {
874  throw;
875  }
876  return fallbackDefault;
877  }
878  }
879  }
880 }
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
Definition: CultureInfo.cs:263
static bool ReusePort
Setting this property value to true causes all outbound TCP connections from HttpWebRequest to use th...
static RemoteCertificateValidationCallback ServerCertificateValidationCallback
Gets or sets the callback to validate a server certificate.
static bool EnableDnsRoundRobin
Gets or sets a value that indicates whether a Domain Name Service (DNS) resolution rotates among the ...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
static bool CheckCertificateRevocationList
Gets or sets a T:System.Boolean value that indicates whether the certificate is checked against the c...
static void MemoryBarrier()
Synchronizes memory access as follows: The processor executing the current thread cannot reorder inst...
The exception that is thrown when the execution stack overflows because it contains too many nested m...
EncryptionPolicy
The EncryptionPolicy to use.
static bool Expect100Continue
Gets or sets a T:System.Boolean value that determines whether 100-Continue behavior is used.
Manages the collection of T:System.Net.ServicePoint objects.
Uri GetProxy(Uri destination)
Returns the URI of a proxy.
Definition: __Canon.cs:3
The exception that is thrown when the value of an argument is outside the allowable range of values a...
bool IsLoopback
Gets whether the specified T:System.Uri references the local host.
Definition: Uri.cs:489
delegate bool RemoteCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
Verifies the remote Secure Sockets Layer (SSL) certificate used for authentication.
Validates a server certificate.
bool IsBypassed(Uri host)
Indicates that the proxy should not be used for the specified host.
virtual bool ContainsKey(object key)
Determines whether the T:System.Collections.Hashtable contains a specific key.
Definition: Hashtable.cs:983
No authentication is allowed. A client requesting an T:System.Net.HttpListener object with this flag ...
static int DnsRefreshTimeout
Gets or sets a value that indicates how long a Domain Name Service (DNS) resolution is considered val...
Represents a weak reference, which references an object while still allowing that object to be reclai...
static int MaxServicePoints
Gets or sets the maximum number of T:System.Net.ServicePoint objects to maintain at any time.
SslProtocols
Defines the possible versions of T:System.Security.Authentication.SslProtocols.
Definition: SslProtocols.cs:6
Represents a collection of key/value pairs that are organized based on the hash code of the key....
Definition: Hashtable.cs:17
The exception that is thrown when there is not enough memory to continue the execution of a program.
static void SetTcpKeepAlive(bool enabled, int keepAliveTime, int keepAliveInterval)
Enables or disables the keep-alive option on a TCP connection.
static int DefaultConnectionLimit
Gets or sets the maximum number of concurrent connections allowed by a T:System.Net....
static int MaxServicePointIdleTime
Gets or sets the maximum idle time of a T:System.Net.ServicePoint object.
WebExceptionStatus
Defines status codes for the T:System.Net.WebException class.
const int DefaultNonPersistentConnectionLimit
The default number of non-persistent connections (4) allowed on a T:System.Net.ServicePoint object co...
SecurityProtocolType
Specifies the security protocols that are supported by the Schannel security package.
static SecurityProtocolType SecurityProtocol
Gets or sets the security protocol used by the T:System.Net.ServicePoint objects managed by the T:Sys...
Attribute can be applied to an enumeration.
Represents errors that occur during application execution.To browse the .NET Framework source code fo...
Definition: Exception.cs:22
virtual void Remove(object key)
Removes the element with the specified key from the T:System.Collections.Hashtable.
Definition: Hashtable.cs:1349
static ICertificatePolicy CertificatePolicy
Gets or sets policy for server certificates.
static bool UseNagleAlgorithm
Determines whether the Nagle algorithm is used by the service points managed by this T:System....
Provides the base interface for implementation of proxy access for the T:System.Net....
Definition: IWebProxy.cs:5
static ServicePoint FindServicePoint(Uri address)
Finds an existing T:System.Net.ServicePoint object or creates a new T:System.Net.ServicePoint object ...
Provides information about a specific culture (called a locale for unmanaged code development)....
Definition: CultureInfo.cs:16
const int DefaultPersistentConnectionLimit
The default number of persistent connections (2) allowed on a T:System.Net.ServicePoint object connec...
Provides an object representation of a uniform resource identifier (URI) and easy access to the parts...
Definition: Uri.cs:19
The exception that is thrown when a call is made to the M:System.Threading.Thread....
static ServicePoint FindServicePoint(Uri address, IWebProxy proxy)
Finds an existing T:System.Net.ServicePoint object or creates a new T:System.Net.ServicePoint object ...
Defines a dictionary key/value pair that can be set or retrieved.
static ServicePoint FindServicePoint(string uriString, IWebProxy proxy)
Finds an existing T:System.Net.ServicePoint object or creates a new T:System.Net.ServicePoint object ...
Provides connection management for HTTP connections.
Definition: ServicePoint.cs:16
virtual int Count
Gets the number of key/value pairs contained in the T:System.Collections.Hashtable.
Definition: Hashtable.cs:658
Creates and controls a thread, sets its priority, and gets its status.
Definition: Thread.cs:18