using System; using System.Collections.Generic; using System.Text; using MyDownloader.Core; using System.Net; using System.Net.Security; using System.Security.Cryptography.X509Certificates; namespace MyDownloader.Extension.Protocols { public class BaseProtocolProvider { static BaseProtocolProvider() { ServicePointManager.DefaultConnectionLimit = int.MaxValue; } protected WebRequest GetRequest(ResourceLocation location) { WebRequest request = WebRequest.Create(location.URL); request.Timeout = 30000; SetProxy(request); return request; } protected void SetProxy(WebRequest request) { if (HttpFtpProtocolExtension.parameters.UseProxy) { WebProxy proxy = new WebProxy(HttpFtpProtocolExtension.parameters.ProxyAddress, HttpFtpProtocolExtension.parameters.ProxyPort); proxy.BypassProxyOnLocal = HttpFtpProtocolExtension.parameters.ProxyByPassOnLocal; request.Proxy = proxy; if (!String.IsNullOrEmpty(HttpFtpProtocolExtension.parameters.ProxyUserName)) { request.Proxy.Credentials = new NetworkCredential( HttpFtpProtocolExtension.parameters.ProxyUserName, HttpFtpProtocolExtension.parameters.ProxyPassword, HttpFtpProtocolExtension.parameters.ProxyDomain); } } } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)