Hello all! I'm doing a simple example using polipo with tor and it's working fine on my firefox browser. I've set polipo as the proxy and the browser works just fine.
Then I tried doing a simple request in node.js based on a simple example, and it didn't work. (code at the end of email). If I try doing the request to http://check.torproject.org, it works fine. But If I do the request to https://, the following error occurs: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd"> <html><head> <title>Proxy error: 400 Couldn't parse URL.</title> </head><body> <h1>400 Couldn't parse URL</h1> <p>The following error occurred while trying to access <strong> https://check.torproject.org</strong>:<br><br> <strong>400 Couldn't parse URL</strong></p> <hr>Generated Mon, 23 Dec 2013 17:22:04 BRST by Polipo on <em>localhost:8118</em>. </body></html> The headers I'm sending: options: { protocol: 'http:', slashes: true, auth: null, host: 'localhost:8118', port: '8118', hostname: 'localhost', hash: null, search: null, query: null, pathname: '/', path: 'https://check.torproject.org', href: 'https://check.torproject.org', headers: { accept: '*/*', 'content-length': 0, host: 'https://check.torproject.org' } } The weird thing is that this page works fine on firefox. I'm wondering if I'm doing something wrong with this code, or if I simply can't do a HTTPS request using polipo. Does anyone have any solution or something that I may test? Thank you! THE CODE: var request = function(name, url, proxy) { // options var options = URL.parse(url, false); // headers options.headers = { accept: '*/*', 'content-length': 0 }; var body = ''; // proxy set if(proxy) { var proxy = URL.parse(proxy, false); options.path = options.protocol+ '//'+ options.host+ options.path; options.headers.host = options.path; options.protocol = proxy.protocol; options.host = proxy.host; options.port = proxy.port; options.hostname = proxy.hostname; } console.log(name, 'request options:', options); var r = (options.protocol == 'http:'?http:https).request(options, function(res) { res.on('end', function() { // just print ip, instead of whole body //console.log(name, body.match(/check_ip" value="([^"]*)"/)[1]); console.log(body); // console.log(name, body); }); res.on('readable', function() { body += this.read().toString(); }); }); r.end(); }; request('with proxy', 'https://check.torproject.org/', " http://localhost:8118"); ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Polipo-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/polipo-users
