From e20246eb5a631fcb23630d13372ee0165ec904cb Mon Sep 17 00:00:00 2001 From: ruri Date: Tue, 30 Apr 2019 00:05:55 +0200 Subject: [PATCH] Temporary fix for proxy issue in CF Bypass block (only supports HTTP proxies for now). --- .../Pages/StackerBlocks/PageBlockBypassCF.xaml | 2 ++ RuriLib/Blocks/BlockBypassCF.cs | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/OpenBullet/Pages/StackerBlocks/PageBlockBypassCF.xaml b/OpenBullet/Pages/StackerBlocks/PageBlockBypassCF.xaml index 0e34cad..73f4347 100644 --- a/OpenBullet/Pages/StackerBlocks/PageBlockBypassCF.xaml +++ b/OpenBullet/Pages/StackerBlocks/PageBlockBypassCF.xaml @@ -28,6 +28,8 @@ TextWrapping="Wrap" Margin="0 10 0 0" Foreground="{DynamicResource ForegroundMain}"> + This block only works with HTTP proxies for now. + If the Cloudflare challenge needs a reCaptcha to be solved, this block will check if you defined a 2captcha or anti-captcha API Key. If it finds one, it will be used to solve the challenges. diff --git a/RuriLib/Blocks/BlockBypassCF.cs b/RuriLib/Blocks/BlockBypassCF.cs index d9f6eb5..0e0124c 100644 --- a/RuriLib/Blocks/BlockBypassCF.cs +++ b/RuriLib/Blocks/BlockBypassCF.cs @@ -112,10 +112,22 @@ namespace RuriLib if (data.UseProxies) { + if (data.Proxy.Type != Extreme.Net.ProxyType.Http) + { + throw new Exception($"The proxy type {data.Proxy.Type} is not supported by this block yet"); + } + var client = data.Proxy.GetClient(); + var proxy = new WebProxy(data.Proxy.Proxy, false); + + if (data.Proxy.Username != "") + { + proxy.Credentials = new NetworkCredential(data.Proxy.Username, data.Proxy.Password); + } + handler = new HttpClientHandler() { - Proxy = (IWebProxy)client, + Proxy = proxy, CookieContainer = cookies, AllowAutoRedirect = true, AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate