Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryCreate()

static bool System.Net.Http.HttpWindowsProxy.TryCreate ( [NotNullWhen(true)] out IWebProxy proxy)
inlinestatic

Definition at line 44 of file HttpWindowsProxy.cs.

45 {
46 global::Interop.WinHttp.SafeWinHttpHandle safeWinHttpHandle = null;
47 proxy = null;
48 WinInetProxyHelper winInetProxyHelper = new WinInetProxyHelper();
49 if (!winInetProxyHelper.ManualSettingsOnly && !winInetProxyHelper.AutoSettingsUsed)
50 {
51 return false;
52 }
53 if (winInetProxyHelper.AutoSettingsUsed)
54 {
55 if (System.Net.NetEventSource.Log.IsEnabled())
56 {
57 System.Net.NetEventSource.Info(winInetProxyHelper, FormattableStringFactory.Create("AutoSettingsUsed, calling {0}", "WinHttpOpen"), "TryCreate");
58 }
59 safeWinHttpHandle = global::Interop.WinHttp.WinHttpOpen(IntPtr.Zero, 1u, null, null, 268435456);
60 if (safeWinHttpHandle.IsInvalid)
61 {
62 if (System.Net.NetEventSource.Log.IsEnabled())
63 {
64 System.Net.NetEventSource.Error(winInetProxyHelper, FormattableStringFactory.Create("{0} returned invalid handle", "WinHttpOpen"), "TryCreate");
65 }
66 return false;
67 }
68 }
70 return true;
71 }
HttpWindowsProxy(WinInetProxyHelper proxyHelper, global::Interop.WinHttp.SafeWinHttpHandle sessionHandle)
static readonly System.Net.NetEventSource Log
static void Info(object thisOrContextObject, FormattableString formattableString=null, [CallerMemberName] string memberName=null)
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static FormattableString Create(string format, params object?[] arguments)

References System.Net.Http.HttpWindowsProxy.HttpWindowsProxy(), System.Runtime.CompilerServices.FormattableStringFactory.Create(), System.Net.NetEventSource.Error(), System.Net.NetEventSource.Info(), System.Net.NetEventSource.Log, and System.IntPtr.Zero.

Referenced by System.Net.Http.SystemProxyInfo.ConstructSystemProxy().