public ProxyHttpRequestSelector(ProxySelector selector, IHttpWire wire)
     : base(wire)
 {
     _selector = selector;
     _selectorCopy = new HttpProxySelector(selector.FetchProxies());
     _error = new Stack<AttemptPair>();
 }
示例#2
0
 public ProxyHttpRequestSelector(ProxySelector selector, string url)
     : base(url)
 {
     _selector     = selector;
     _selectorCopy = new HttpProxySelector(selector.FetchProxies());
     _error        = new Stack <AttemptPair>();
 }
 public ProxyHttpRequestSelector(ProxySelector selector, IHttpWire wire)
     : base(wire)
 {
     _selector     = selector;
     _selectorCopy = new HttpProxySelector(selector.FetchProxies());
     _error        = new Stack <AttemptPair>();
 }
示例#4
0
 public ProxySelectorImpl(ProxySelector selector)
 {
     _selector = selector;
 }
示例#5
0
 public static IHttpRequestFactory CreateProxySelector(ProxySelector selector)
 {
     return(new ProxySelectorImpl(selector));
 }
 public static IHttpRequestFactory CreateProxySelector(ProxySelector selector)
 {
     return new ProxySelectorImpl(selector);
 }
 public ProxySelectorImpl(ProxySelector selector)
 {
     _selector = selector;
 }
示例#8
0
        protected void InitProxies()
        {
            TotalOperations += Proxies.Length;

            if (Proxies.Length > 0)
            {
                var selector = new ProxySelector();

                foreach (var proxyString in Proxies)
                {
                    var proxy = Proxy.FromString(proxyString);
                    RequestFactory = HttpRequestFactory.CreateProxyFactory(proxy);
                    if (TestProxy())
                    {
                        Log.InfoFormat("Proxy added, Proxy={0}", proxy);
                        selector.Add(proxy);
                    }
                    else
                        Log.InfoFormat("Proxy failed, Proxy={0}", proxy);

                    OnProgress();
                }

                if (selector.ProxyCount == 0)
                {
                    Log.Info("No poxies pass test. Fail.");
                    Thread.CurrentThread.Abort();
                }

                RequestFactory = HttpRequestFactory.CreateProxySelector(selector);
            }
        }