NLnetLabs / domain

A DNS library for Rust.
https://nlnetlabs.nl/projects/domain/about/
BSD 3-Clause "New" or "Revised" License
349 stars 59 forks source link

Reject empty TXT record data and never build it. #267

Closed partim closed 8 months ago

partim commented 8 months ago

This PR changes the rdata::Txt type to reject empty record data as invalid.

RFC 1035 states that the TXT-DATA is “One or more \<character-string>s”. This means that there will have to be at least the length octet of the first character string.

The PR also adjusts the TxtBuilder to never return a empty data. Since this requires being able to return an error in TxtBuilder:.finish, this is a breaking change. While at it, the PR also adds more control over the created character strings by making close_char_str public and adding a new append_char_str method.

The PR also improves the documentation for the TXT record data types.

Fixes #260.