我使用node-curl作为HTTPS客户端向Web上的资源发出请求,代码在面向Internet的代理服务器后面运行。node-curl中的数据块(node.js)
的代码我使用合作:
var curl = require('node-curl');
//Call the curl function. Make a curl call to the url in the first argument.
//Make a mental note that the callback to be invoked when the call is complete
//the 2nd argument. Then go ahead.
curl('https://encrypted.google.com/', {}, function(err) {
//I have no idea about the difference between console.info and console.log.
console.info(this.body);
});
//This will get printed immediately.
console.log('Got here');
节点卷曲检测从环境中的代理服务器设置,并还给了预期的效果。
面临的挑战是:在整个https响应被下载后,回调被触发,并且据我所知,http(s)模块中没有'data' and 'end' events的类似情况。另外,在通过源代码之后,我发现节点卷发库确实以块:参考线58的形式接收数据https://github.com/jiangmiao/node-curl/blob/master/lib/CurlBuilder.js。在这种情况下,目前似乎没有发生任何事件。
我需要将可能大小的响应转发回局域网中的另一台计算机进行处理,所以这是我的一个明确的问题。
正在使用node-curl为此目的在节点中推荐?
如果是,我该如何处理?
如果不是,那么将会是一个合适的替代方案?
我感谢你的及时和出色的单词编辑答案。我会回到你身上,看看我是否真的终于使用这个。但这是非常棒的。 – user1514989 2012-07-13 11:18:48
谢谢你说 - 这实际上是什么让我和(我认为)所有的StackOverflow打勾!如果你不使用它,至少现在你知道请求模块,我发现它非常有用。 – 2012-07-13 11:29:19