diff --git a/pure-parser.js b/pure-parser.js index 8158065..ddf696b 100644 --- a/pure-parser.js +++ b/pure-parser.js @@ -170,9 +170,9 @@ pdns.unpack = function (ab) { // TODO actually parse RDATA console.log(ab.byteLength, ab.byteLength - total, ab.byteLength + -total + q.rdlength); q.rdata = new Uint8Array(ab).slice(total, total + q.rdlength); - console.log('q.rdata', q.rdata.byteLength); + console.log('q.rdata', q.rdata.byteLength, 'bytes:'); + q.rdata = Array.prototype.slice.apply(q.rdata); console.log(q.rdata); - q.rdata = Array.prototype.slice.apply(q.data); console.log('total', total); total += q.rdlength; @@ -203,13 +203,17 @@ pdns.unpack = function (ab) { console.log('nscount', nscount); header.authority = []; for (i = 0; i < nscount; i += 1) { - unpackAnswer(header.authority); + rec = unpackAnswer(ab, dv, total); + total += rec.qtotal; + header.authority.push(rec); } console.log('arcount', arcount); header.additional = []; for (i = 0; i < arcount; i += 1) { - unpackAnswer(header.additional); + rec = unpackAnswer(ab, dv, total); + total += rec.qtotal; + header.additional.push(rec); } if (ab.byteLength !== total) {