我一直在努力弄清如何使用Node.js(v0.3.8)安全连接到HTTP服务器。 我有以下代码:
var http = require("http");
var client = http.createClient(443, host, /* secure= */ true);
var request = client.request("GET", relativeUrl, { host: host });
当我运行它时,出现以下提示:
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Parse Error
at Client.onData [as ondata] (http.js:1287:27)
at Client._onReadable (net.js:648:27)
at IOWatcher.onReadable [as callback] (net.js:156:10)
我已经在谷歌上搜了半个小时的答案,并阅读了http://nodejs.org/上的文档。我缺少什么?