public bool ShouldProxyBeBypassed(HttpProxySettings proxySettings, HttpUri url) { //We are utilizing the WebProxy implementation here to save us having to re-implement it. This way we use Microsofts implementation var proxy = new WebProxy(proxySettings.Host + ":" + proxySettings.Port, proxySettings.BypassLocalAddress, proxySettings.BypassListAsArray); return(proxy.IsBypassed((Uri)url)); }
protected virtual System.Net.Http.HttpClient CreateHttpClient(HttpProxySettings proxySettings) { var handler = new SocketsHttpHandler() { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Brotli, UseCookies = false, // sic - we don't want to use a shared cookie container AllowAutoRedirect = false, Credentials = GetCredentialCache(), PreAuthenticate = true, MaxConnectionsPerServer = 12, ConnectCallback = onConnect, SslOptions = new SslClientAuthenticationOptions { RemoteCertificateValidationCallback = _certificateValidationService.ShouldByPassValidationError } }; if (proxySettings != null) { handler.Proxy = _createManagedWebProxy.GetWebProxy(proxySettings); } var client = new System.Net.Http.HttpClient(handler) { Timeout = Timeout.InfiniteTimeSpan }; return(client); }
public HttpProxySettings SetHttpProxy(HttpProxySettings settings) { if (_dataContainer != null) _dataContainer.HttpProxySettings = settings; return settings; }
public void CopyProperties(HttpProxySettings source) { this.UseProxy = source.UseProxy; this.ProxyHost = source.ProxyHost; this.ProxyPort = source.ProxyPort; this.UserName = source.UserName; this.Password = source.Password; }
private void HttpProxySettingsToolStripMenuItem_Click(object sender, EventArgs e) { try { HttpProxySettings settings = _dataContainer.HttpProxySettings; HttpProxySettingsForm form = new HttpProxySettingsForm { HttpProxySettings = settings }; if (form.ShowDialog() == DialogResult.OK) form.HttpProxySettings.Save(); } catch (Exception ex) { ex.ToMessageBox(); } }
public HttpProxySettings GetProxySettings(HttpRequest request) { if (!_configService.ProxyEnabled) { return(null); } var proxySettings = new HttpProxySettings(_configService.ProxyType, _configService.ProxyHostname, _configService.ProxyPort, _configService.ProxyBypassFilter, _configService.ProxyBypassLocalAddresses, _configService.ProxyUsername, _configService.ProxyPassword); if (ShouldProxyBeBypassed(proxySettings, request.Url)) { return(null); } return(proxySettings); }
public HttpsConnectionFactory(HttpProxySettings proxySettings) { this.ProxySettings = proxySettings; this.TargetPort = 8099; }
public HttpsConnectionFactory(HttpProxySettings proxySettings) { this.ProxySettings = proxySettings; this.TargetPort = 8099; }