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

◆ GetMultiProxy()

MultiProxy System.Net.Http.HttpWindowsProxy.GetMultiProxy ( Uri uri)
inline

Implements System.Net.Http.IMultiWebProxy.

Definition at line 181 of file HttpWindowsProxy.cs.

182 {
184 {
185 global::Interop.WinHttp.WINHTTP_PROXY_INFO proxyInfo = default(global::Interop.WinHttp.WINHTTP_PROXY_INFO);
186 try
187 {
189 {
190 return MultiProxy.Empty;
191 }
192 if (proxyInfo.ProxyBypass == IntPtr.Zero)
193 {
194 if (proxyInfo.Proxy != IntPtr.Zero)
195 {
197 return MultiProxy.CreateLazy(_failedProxies, proxyConfig, IsSecureUri(uri));
198 }
199 return MultiProxy.Empty;
200 }
201 }
202 finally
203 {
205 Marshal.FreeHGlobal(proxyInfo.ProxyBypass);
206 }
207 }
209 {
210 if (_bypassLocal)
211 {
212 if (uri.IsLoopback)
213 {
214 return MultiProxy.Empty;
215 }
216 if ((uri.HostNameType == UriHostNameType.IPv6 || uri.HostNameType == UriHostNameType.IPv4) && IPAddress.TryParse(uri.IdnHost, out IPAddress address))
217 {
218 foreach (IPAddress item in _localIp)
219 {
220 if (item.Equals(address))
221 {
222 return MultiProxy.Empty;
223 }
224 }
225 }
226 if (uri.HostNameType != UriHostNameType.IPv6 && !uri.IdnHost.Contains('.'))
227 {
228 return MultiProxy.Empty;
229 }
230 }
231 if (_bypass != null)
232 {
233 foreach (string item2 in _bypass)
234 {
235 if (SimpleRegex.IsMatchWithStarWildcard(uri.IdnHost, item2))
236 {
237 return MultiProxy.Empty;
238 }
239 }
240 }
241 if (!IsSecureUri(uri))
242 {
243 return _insecureProxy;
244 }
245 return _secureProxy;
246 }
247 return MultiProxy.Empty;
248 }
readonly WinInetProxyHelper _proxyHelper
readonly List< string > _bypass
readonly List< IPAddress > _localIp
global::Interop.WinHttp.SafeWinHttpHandle _sessionHandle
readonly FailedProxyCache _failedProxies
bool GetProxyForUrl(global::Interop.WinHttp.SafeWinHttpHandle sessionHandle, Uri uri, out global::Interop.WinHttp.WINHTTP_PROXY_INFO proxyInfo)
static void FreeHGlobal(IntPtr hglobal)
Definition Marshal.cs:1680
static unsafe? string PtrToStringUni(IntPtr ptr)
Definition Marshal.cs:652
static bool IsMatchWithStarWildcard(ReadOnlySpan< char > input, ReadOnlySpan< char > pattern)
Definition SimpleRegex.cs:5
static MultiProxy Empty
Definition MultiProxy.cs:21

References System.Net.Http.HttpWindowsProxy._bypass, System.Net.Http.HttpWindowsProxy._bypassLocal, System.Net.Http.HttpWindowsProxy._failedProxies, System.Net.Http.HttpWindowsProxy._insecureProxy, System.Net.Http.HttpWindowsProxy._localIp, System.Net.Http.HttpWindowsProxy._proxyHelper, System.Net.Http.HttpWindowsProxy._secureProxy, System.Net.Http.HttpWindowsProxy._sessionHandle, System.Net.Http.WinInetProxyHelper.AutoSettingsUsed, System.Net.Http.MultiProxy.CreateLazy(), System.Net.Http.MultiProxy.Empty, System.Runtime.InteropServices.Marshal.FreeHGlobal(), System.Net.Http.WinInetProxyHelper.GetProxyForUrl(), System.Uri.HostNameType, System.Uri.IdnHost, System.Uri.IsLoopback, System.Text.SimpleRegex.IsMatchWithStarWildcard(), System.Net.Http.HttpWindowsProxy.IsSecureUri(), System.item, System.Net.Http.WinInetProxyHelper.ManualSettingsUsed, System.Runtime.InteropServices.Marshal.PtrToStringUni(), System.Net.Http.WinInetProxyHelper.RecentAutoDetectionFailure, System.Net.IPAddress.TryParse(), and System.IntPtr.Zero.

Referenced by System.Net.Http.HttpWindowsProxy.GetProxy().