I'm trying to use Tor-Server as a proxy in HttpWebRequest, my code looks like this:
HttpWebRequest request;
HttpWebResponse response;
request = (HttpWebRequest)WebRequest.Create("http://www.google.com");
request.Proxy = new WebProxy("127.0.0.1:9051");
response = (HttpWebResponse)request.GetResponse();
response.Close();
it works perfect with "normal" proxies but with Tor I'm getting Exceptions while calling
GetResponse() with Status = ServerProtocolViolation. The message is (in German...):Message = "Der Server hat eine Protokollverletzung ausgeführt.. Section=ResponseStatusLine"
If you have privoxy installed and running you can do
request.Proxy = new WebProxy("127.0.0.1:8118"); // default privoxy port
Which will enable you to make requests using tor
Tor is not an HTTP proxy. It's a SOCKS proxy. You can use an HTTP proxy that supports forwarding on SOCKS (like Privoxy) and connect to that via code instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With