0
我想通過NodeJs上的Cntlm代理髮出HTTP請求,但我無法讓它工作。這是我的代碼:通過Cntlm代理的Http請求。
var http = require('http');
var options = {
host: 'http://127.0.0.1',
port: 3128,
path: "http://www.google.com",
headers: {
Host: "www.google.com"
}
};
http.get(options, function(res) {
console.log("Got response: " + res.statusCode);
}).on('error', function(e) {
console.log("Got error: " + e.stack);
});
我總是得到以下錯誤:
Got error: Error: getaddrinfo ENOTFOUND
at errnoException (dns.js:37:11)
at Object.onanswer [as oncomplete] (dns.js:124:16)
請幫助。