Check for callback argument in DNS functions

This commit is contained in:
Ryan Dahl committed 2010-03-16 10:48:14 -07:00
1 parent 3c97a4391a
commit 217e4b40d4
2 files changed
+13

No files matched your search

+5
View File
@@ -332,6 +332,11 @@ static Handle<Value> ResolveA(int type, const Arguments& args) {
String::New("Argument must be a string.")));
}
if (!args[1]->IsFunction()) {
return ThrowException(Exception::Error(
String::New("Missing callback argument")));
}
String::Utf8Value name(args[0]->ToString());
struct dns_query *query;
+8
View File
@@ -3,6 +3,14 @@ require("../common");
var dns = require("dns"),
sys = require("sys");
// Try resolution without callback
assert.throws(function () {
dns.resolve('google.com', 'A');
})
var hosts = ['example.com', 'example.org',
'ietf.org', // AAAA
'google.com', // MX, multiple A records