Skip to content

Commit

Permalink
fixed sending SOA for All AAAA queries
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenixlzx committed Feb 1, 2014
1 parent b467fcb commit 5f50bba
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions dnsserver.js
Expand Up @@ -415,6 +415,20 @@ function minimoedns(request, response) {
result = result.sort(randomOrder);
result.forEach(function(record) {
switch (record.type) {
case "AAAA":
response.answer.push(dns.AAAA({
name: record.name,
address: record.content,
ttl: record.ttl||config.defaultTTL
}));
break;
case "CNAME":
response.answer.push(dns.CNAME({
name: record.name,
data: record.content,
ttl: record.ttl||config.defaultTTL
}));
break;
case "A":
var content = SOAresult[0].content.split(" ");
response.authority.push(dns.SOA({
Expand All @@ -431,20 +445,6 @@ function minimoedns(request, response) {
response.header.rcode = consts.NAME_TO_RCODE.NOERROR;
return response.send();
break;
case "AAAA":
response.answer.push(dns.AAAA({
name: record.name,
address: record.content,
ttl: record.ttl||config.defaultTTL
}));
break;
case "CNAME":
response.answer.push(dns.CNAME({
name: record.name,
data: record.content,
ttl: record.ttl||config.defaultTTL
}));
break;
}
});
authorityNS(response, tldname, function() {
Expand Down Expand Up @@ -473,6 +473,20 @@ function minimoedns(request, response) {
doc = doc.sort(randomOrder);
doc.forEach(function(docResult) {
switch (docResult.type) {
case "AAAA":
response.answer.push(dns.AAAA({
name: name,
address: docResult.content,
ttl: docResult.ttl||config.defaultTTL
}));
break;
case "CNAME":
response.answer.push(dns.CNAME({
name: name,
data: docResult.content,
ttl: docResult.ttl||config.defaultTTL
}));
break;
case "A":
var content = SOAresult[0].content.split(" ");
response.authority.push(dns.SOA({
Expand All @@ -489,20 +503,6 @@ function minimoedns(request, response) {
response.header.rcode = consts.NAME_TO_RCODE.NOERROR;
return response.send();
break;
case "AAAA":
response.answer.push(dns.AAAA({
name: name,
address: docResult.content,
ttl: docResult.ttl||config.defaultTTL
}));
break;
case "CNAME":
response.answer.push(dns.CNAME({
name: name,
data: docResult.content,
ttl: docResult.ttl||config.defaultTTL
}));
break;
}
});
authorityNS(response, tldname, function() {
Expand Down

0 comments on commit 5f50bba

Please sign in to comment.