Пример #1
0
        public static void SetWarp(this WebRequest webRequest, WarpEngine warpEngine, IWebProxy proxy)
        {
            warpEngine.SetWarp(webRequest);

            if (proxy != null)
            {
                // warproxy header
                string base64String;

                if (proxy is WebProxy)
                {
                    base64String = Helper.FromProxy(proxy as WebProxy);
                }
                else
                {
                    WebProxy webProxy = new WebProxy(proxy.GetProxy(webRequest.RequestUri));
                    webProxy.Credentials = proxy.Credentials.GetCredential(webRequest.RequestUri, "BASIC");
                    base64String = Helper.FromProxy(webProxy);
                }

                webRequest.Headers.Set("warproxy", base64String);
            }
        }
Пример #2
0
 public static void SetWarp(this WebRequest webRequest, WarpEngine warpEngine)
 {
     warpEngine.SetWarp(webRequest);
 }