public static HttpClient GetClient(string siteId, HttpProxyPool httpProxyPool = null)
 {
     var site = SiteConfiguration.Instance.GetSite(siteId);
     var httpClientHandler = new HttpClientHandler {CookieContainer = new CookieContainer() {}};
     if(site.IsUseHttpProxy && httpProxyPool != null)
         httpClientHandler.Proxy = httpProxyPool.RandomProxy();
     httpClientHandler.UseProxy = true;
     httpClientHandler.UseCookies = true;
     return new HttpClient(httpClientHandler);
 }
Beispiel #2
0
 public void ReturnHttpProxy(UseSpecifiedUriWebProxy proxy, HttpStatusCode statusCode)
 {
     HttpProxyPool?.ReturnProxy(proxy, statusCode);
 }
Beispiel #3
0
 public UseSpecifiedUriWebProxy GetHttpProxy()
 {
     return(HttpProxyPool?.GetProxy());
 }