cellengine / bindns

Fast DNS library, server and client for Node.js based on libbind-6
18 stars 7 forks source link

TypeError: Cannot read property 'charCodeAt' of undefined #4

Closed NilsFrkal closed 4 years ago

NilsFrkal commented 4 years ago

I haven't figured out for which requests this happens but in ns_name.js

digits[c / 100].charCodeAt(0) digits[c % 100 / 10].charCodeAt(0)

will result in error if c takes certain values e.g. 195 as c / 195 = 1.95 -> digits[1.95] is undefined and c % 100 / 10 = 9.5 > digits[9.5] is undefined

Thanks, Nils

zbjornson commented 4 years ago

Thanks for the report, will look as soon as I can.

zbjornson commented 4 years ago

@NilsFrkal the above commit should fix it. Please let me know if you encounter it again.

NilsFrkal commented 4 years ago

Tha k you. I will try it out and let you know.

May I ask you another question please? What does the TTL in MessageRR do? Is there anyway to manipulate/define the FNS answef is cached by the cinsumer? I have a use case where I would like to force the consumer) e.g. browser and OS level dns cache to send the request to nodejs every time the page is refreshed. Do you know if this is possible?

Thank you very much.

Best, Nils

On 8 March 2020 5:51:06 am AEDT, Zach Bjornson notifications@github.com wrote:

Closed #4 via ada38460dbee4e19ab2e0065171bbeb4aa961de3.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/primitybio/bindns/issues/4#event-3107913664

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

zbjornson commented 4 years ago

From RFC 1035:

the time interval that the resource record may be cached before the source of the information should again be consulted. Zero values are interpreted to mean that the RR can only be used for the transaction in progress, and should not be cached. For example, SOA records are always distributed with a zero TTL to prohibit caching. Zero values can also be used for extremely volatile data.

For your case, you should theoretically be able to set it to 0, but practically, (1) not all clients and resolvers will obey this (MacOS X apparently has a minimum of 12.5 seconds) and (2) at least historically some clients interpreted 0 incorrectly (see this).

NilsFrkal commented 4 years ago

Brilliant, thanks a lot. Really appreciate your response.

Best, Nils

On 12 March 2020 1:19:36 pm AEDT, Zach Bjornson notifications@github.com wrote:

From RFC 1035:

the time interval that the resource record may be cached before the source of the information should again be consulted. Zero values are interpreted to mean that the RR can only be used for the transaction in progress, and should not be cached. For example, SOA records are always distributed with a zero TTL to prohibit caching. Zero values can also be used for extremely volatile data.

For your case, you should theoretically be able to set it to 0, but practically, (1) not all clients and resolvers will obey this (MacOS X apparently has a minimum of 12.5 seconds) and (2) at least historically some clients interpreted 0 incorrectly (see this).

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/primitybio/bindns/issues/4#issuecomment-597972822

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.