TIdDNSResolver update

A user recently encountered a problem where requesting TXT records for ‘’ on multiple DNS servers results in DNS responses that exceed DNS’s default 512-byte max UDP message size, thus truncating to 512 bytes and setting the TC (truncation) bit in the response header.

A logic hole in TTextRecord.Parse() was causing TIdDNSResolver to get stuck in an endless loop when this happens.

*Some* handing for truncated responses as now been added to TIdDNSResolver. Namely, TIdDNSResolver will *attempt* to parse as much data as it can and not raise an error if the TC flag is set. It is then your code’s responsibility to check the TIdDNSResolver.DNSHeader.TC property after TIdDNSResolver.Resolve() exits to see if a truncated response was received.

Most DNS resolvers will react to the TC flag by retrying the same DNS request over TCP instead of UDP. TIdDNSResolver does not (yet) do this.

However, EDNS provides an Extensions mechansim for DNS, and one of the available extensions is a larger UDP message size. So, to help avoid (but not completely eliminate) receiving truncated responses over UDP from DNS servers that support EDNS, TIdDNSResolver now reports a UDP receive size of 1280 bytes (more than twice DNS’s default) in all UDP-based requests.