Temporary fix for proxy issue in CF Bypass block (only supports HTTP proxies for now).

This commit is contained in:
ruri
2019-04-30 00:05:55 +02:00
parent 6f867204f1
commit e20246eb5a
2 changed files with 15 additions and 1 deletions
@@ -28,6 +28,8 @@
TextWrapping="Wrap" TextWrapping="Wrap"
Margin="0 10 0 0" Margin="0 10 0 0"
Foreground="{DynamicResource ForegroundMain}"> Foreground="{DynamicResource ForegroundMain}">
This block only works with HTTP proxies for now.
<LineBreak/><LineBreak/>
If the Cloudflare challenge needs a reCaptcha to be solved, 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 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. <LineBreak/><LineBreak/> it finds one, it will be used to solve the challenges. <LineBreak/><LineBreak/>
+13 -1
View File
@@ -112,10 +112,22 @@ namespace RuriLib
if (data.UseProxies) 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 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() handler = new HttpClientHandler()
{ {
Proxy = (IWebProxy)client, Proxy = proxy,
CookieContainer = cookies, CookieContainer = cookies,
AllowAutoRedirect = true, AllowAutoRedirect = true,
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate