Пример #1
0
        static void Main(string[] args)
        {
            WarpEngine engine = new WarpEngine();
            engine.MaxQueuedConnections = 5;
            engine.Start();
            engine.SetProxy(HttpWebRequest.DefaultWebProxy);

             			using (WebClient wc = new WebClient())
            {
                wc.Proxy = engine.LocalProxy;

                Console.WriteLine("===== START =====");

                for (int i = 0; i < 20; ++i)
                    Console.WriteLine("Recieved Data Length : {0:00} {1}", i, wc.DownloadData("http://danbooru.donmai.us/").Length);

                Console.WriteLine("=====  END  =====");
            }

            // 			Console.ReadKey();
            // 			Console.ReadKey();
            //
            // 			engine.Stop();
            // 			engine.Dispose();
        }
Пример #2
0
        public WarpThread(WarpEngine warpEngine, Socket socketThread)
        {
            this.m_warpEngine	= warpEngine;

            this.m_client		= socketThread;
            this.m_stmClient	= new ExtStream(this.m_warpEngine.BufferSize);

            this.m_stmServer	= new ExtStream(this.m_warpEngine.BufferSize);

            this.m_thread = new Thread(ProgressThread);
            this.m_thread.Start();
        }
Пример #3
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);
            }
        }
Пример #4
0
 public static void SetWarp(this WebRequest webRequest, WarpEngine warpEngine)
 {
     warpEngine.SetWarp(webRequest);
 }