Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix root domain name parsing #13

Closed
wants to merge 1 commit into from

Conversation

silverwind
Copy link

This fixes a query for the root zone (issued from native-dns), like this:

var question = dns.Question({
    name: "",
    type: "NS",
});

Previously, the returning packet to this query could not be parsed and native-dns never received the packet and ran into a timeout.

From RFC 1035: The root domain name is defined by a single octet of zeros at 92; the root domain name has no labels.

@silverwind
Copy link
Author

One part I wasn't totally sure was if the buffer cursor should be seeked forward by one byte before running buff.tell() to return the current location. The results seem fine with my current method though.

@tjfontaine any thought on this part?

@sindresorhus
Copy link

👍 You should probably add a test ;)

@silverwind
Copy link
Author

I'll look into adding a test.

@taoeffect
Copy link
Collaborator

@silverwind #7 was just merged. Could you check to see if this is relevant to that? (I'm focusing on releasing update to native-dns based on #7, which included many changes/fixes). If it is, can you submit the PR on top of most recent master?

@silverwind
Copy link
Author

@taoeffect I think it should still apply, I'll rebase my branch shortly and test if everything is working fine.

Regarding the tests: I think there were 2 tests failing in the current build, and from a first glance, I think I need to tinker with the testing methods for it to test a "" lookup correctly. Will let you know how that turns out.

@taoeffect
Copy link
Collaborator

Thanks @silverwind! Feel free to add your name to package.json in the list of authors! :)

@silverwind
Copy link
Author

Will do, will probably check this out tomorrow.

@silverwind
Copy link
Author

Looks like this PR is obsolete with your change in #7 which added end = buff.tell();. Queries for empty strings now work as expected. Great work!

@silverwind silverwind closed this Oct 10, 2014
@taoeffect
Copy link
Collaborator

Awesome (thx)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants