Browse Source

Check for callback argument in DNS functions

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
217e4b40d4
  1. 5
      src/node_dns.cc
  2. 8
      test/disabled/test-dns.js

5
src/node_dns.cc

@ -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
test/disabled/test-dns.js

@ -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

Loading…
Cancel
Save