I'm trying to get and set cookies using the Tor API.
The problem is that the SocksPortHandler
doesn't have CookieContainer
nor InnerHandler
.
I tried using Knapcode.SocketToMe.Http.CookieHandler
and set its InnerHandler
to SocksPortHandler
, but with no success. here is the code -
using (CookieHandler cookieHandler = new CookieHandler())
{
SocksPortHandler socksPortHandler = new SocksPortHandler("127.0.0.1", socksPort: 9050);
cookieHandler.InnerHandler = socksPortHandler;
using (HttpClient httpClient = new HttpClient(cookieHandler))
{
.....setting httpClient properties.....
HttpResponseMessage message = httpClient.GetAsync(uri).Result;
response = message.Content.ReadAsStringAsync().Result;
cookieHeader = cookieHandler.CookieContainer.GetCookieHeader(uri);
}
}
how can I do it? Thanks