Skip to content
Snippets Groups Projects
Commit dbcc780e authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Also, parse and return the header.

parent 87e56af6
No related branches found
No related tags found
1 merge request!118Implement support for callback style programming
Pipeline #1734 passed
......@@ -232,6 +232,15 @@ var DNS = new function(servers)
q = DNS.outstanding[id];
delete DNS.outstanding[id];
ret.id = id;
ret.response = !!(ascii(resp[2]) & 1);
ret.opcode = (ascii(resp[2]) & 0x1e) >> 1;
ret.authoritative = !!(ascii(resp[2]) & (1<<5));
ret.truncation = !!(ascii(resp[2]) & (1<<6));
ret.recusrion = !!(ascii(resp[2]) & (1<<7));
ret.reserved = ascii(resp[3]) & 7;
ret.rcode = ascii(resp[3] & 0xf1) >> 3;
queries = DNS.string_to_int16(resp.substr(4, 2));
answers = DNS.string_to_int16(resp.substr(6, 2));
nameservers = DNS.string_to_int16(resp.substr(8, 2));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment