HTTP-Anfragen über einen SOCKS5-Proxy in NodeJS ausführen

Ich bin Planung zu tun, eine Reihe von HTTP-requests in NodeJS obwohl Tor.
Tor verwendet SOCKS5 also ging ich raus und suchte nach einem Weg zu proxify HTTP-requests in NodeJS.
Ich Plane, die die Standard-http.request () - Funktion, um die Arbeit zu tun.
Aber ich kann nicht scheinen, einen Weg zu finden, um einen proxy zu verwenden.
Jemand schlug vor, dass ich dies tun könnte:

var http = require("http");
var options = {
  host: "localhost",
  port: 9050,
  path: "http://check.torproject.org",
  method: 'GET',
  headers: {
    Host: "http://check.torproject.org",
  }
};
var req = http.request(options, function(res) {
  res.on('data', function (chunk) {
    console.log('BODY: ' + chunk);
  });
});

Aber es hat nicht funktioniert.
Also, irgendwelche Vorschläge?

InformationsquelleAutor der Frage Fredefl | 2012-07-17

Schreibe einen Kommentar