Added proxy authentication#25
Conversation
0824ca7 to
8f52d81
Compare
|
Thanks. We're having an issue with NuGet, but once that's resolved we'll push a new version with this. |
|
I'm just maintaining FlareSolverr while the actual dev is away. I was able to test this PR easily enough using Jackett, however other than 'does it still work with Jackett' I am not sure how to test those PRs specifically. If you could provide scripts or commands I can use on Windows to run as tests, I'll be happy to take a look them. |
I've got some free time just now and I managed to write this (with using FlareSolverrSharp.Solvers;
using FlareSolverrSharp.Types;
using System.Reflection;
namespace Playground
{
class Program
{
static async Task Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine($"Usage: dotnet run {Assembly.GetExecutingAssembly().Location} <FlareSolverr URL>");
return;
}
FlareSolverr solver = new(args[0]);
FlareSolverrIndexResponse indexResponse = await solver.GetIndex();
Console.WriteLine("GetIndex() returned the following:");
Console.WriteLine($" Message = '{indexResponse.Message}'");
Console.WriteLine($" Version = '{indexResponse.Version}'");
Console.WriteLine($" UserAgent = '{indexResponse.UserAgent}'");
Console.WriteLine("Now, I'll save the UserAgent and use it WITHOUT having to call Solve() and do an expensive request.\n");
// Code that uses indexResponse.UserAgent goes here
Uri uri = new("https://setcookie.net/");
HttpRequestMessage request = new(HttpMethod.Get, uri);
Console.WriteLine($"Calling Solve() on {uri} with no cookies...");
FlareSolverrResponse response = await solver.Solve(request);
if (response.Solution.Response.Contains("Received no cookies."))
{
Console.WriteLine("Received no cookies, as expected.");
}
else
{
Console.WriteLine("Received cookies, which is unexpected!");
}
Console.WriteLine($"Calling Solve() on {uri} with 2 cookies...");
response = await solver.Solve(request, cookies: [
new Cookie() { Name = "test", Value = "value" },
new Cookie() { Name = "test2", Value = "value2" }
]);
if (response.Solution.Response.Contains("Received no cookies."))
{
Console.WriteLine("Received no cookies, which is unexpected!");
}
else if (response.Solution.Response.Contains("test = value") &&
response.Solution.Response.Contains("test2 = value2"))
{
Console.WriteLine("Received cookies, as expected.");
}
else
{
Console.WriteLine($"Something went wrong, here's the response:\n{response.Solution.Response}");
}
}
}
}Make sure you're using .NET8 when compiling! |
Adds support for FlareSolverr v3.3.0's proxy authentication.
Resolves #23