Skip to content
Browse files

addRR can send authoritative responses

  • Loading branch information...
1 parent f2e422f commit 08d27252ff6ceb1fa6f102a8a0899a753196fc76 @sstephenson committed May 10, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/dnsserver.js
View
10 lib/dnsserver.js
@@ -179,7 +179,7 @@ function Response(socket, rinfo, query) {
this.rr = [];
}
-Response.prototype.addRR = function(domain, qtype, qclass, ttl, rdata) {
+Response.prototype.addRR = function(domain, qtype, qclass, ttl, rdata, authoritative) {
var r = {}, address;
r.qname = domainToQname(domain);
r.qtype = qtype;
@@ -195,7 +195,13 @@ Response.prototype.addRR = function(domain, qtype, qclass, ttl, rdata) {
}
this.rr.push(r);
- this.header.ancount++;
+
+ if (authoritative) {
+ this.header.aa = 1;
+ this.header.nscount++;
+ } else {
+ this.header.ancount++;
+ }
}
Response.prototype.send = function(callback) {

0 comments on commit 08d2725

Please sign in to comment.
Something went wrong with that request. Please try again.