Correctly parses a packet. Yay!
This commit is contained in:
		
							parent
							
								
									3a46d3efda
								
							
						
					
					
						commit
						0dc182772b
					
				| @ -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) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user