2011-08-03 64 views
1

我有我在一個liunx服務器端口8123上運行polipo實例 我需要使用HTTPS獲取和發佈請求節點通過這個代理服務器。 我會如何做到這一點。我如何使用node.js與請求或任何通過http代理通過https獲取數據

BTW proxychains不足以完成這個任務,因爲它似乎把在隊列中的請求,而不是在一個時間 我可以用襪子給我的任務,但的tsocks打開的連接數似乎並不

工作的一些其他職位建議,克服HTTP將工作

它不


Trying 127.0.0.1... 
Connected to localhost. 
Escape character is '^]'. 
GET https://www.google.com/accounts/OAuthGetRequestToken HTTP/1.1 

HTTP/1.1 400 Couldn't parse URL 
Connection: keep-alive 
Date: Tue, 02 Aug 2011 23:50:34 GMT 
Content-Type: text/html 
Content-Length: 487 
Expires: 0 
Cache-Control: no-cache 
Pragma: no-cache 

<!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://www.google.com/accounts/OAuthGetRequestToken</strong>:<br><br> 
<strong>400 Couldn't parse URL</strong></p> 
<hr>Generated Tue, 02 Aug 2011 19:50:34 EDT by Polipo on <em>ubuntu:8123</em>. 
</body></html> 

Connection closed by foreign host. 

只是如何使這項工作

回答

0

因爲你不顯示任何你的代碼,它是難以確定你的問題。但是,試試這個:

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

請注意,我們將完整的目標URL傳遞到路徑和主機頭。

相關問題