homebridge / ciao

RFC 6762 and RFC 6763 compliant mdns service discovery library written in Typescript
MIT License
79 stars 6 forks source link

Fix TXT record encoding #36

Closed szekelyisz closed 10 months ago

szekelyisz commented 10 months ago

:recycle: Current situation

When the advertised service has no TXT data, the RDATA generated is invalid. RFC 1035 3.3.14. mandates TXT RDATA be "One or more <character-string>s". Currently ciao generates zero <character-string>s if there is no TXT data associated with the service.

In this case other server implementations seem to return a TXT RDATA containing one <character-string> of zero length which is valid according to the RFC.

Most client implementations gracefully handle the invalid data. iOS 17 does not, so currently services advertised by ciao are not discoverable on iOS 17.

:bulb: Proposed solution

Follow other server implementations' behavior: return one <character-string> having length of 0. this.txt is assigned accordingly in TXTRecord constructor.

:gear: Release Notes

Fix TXT record encoding according to RFC 1035.

Testing

No changes.

Reviewer Nudging

Oneliner! ;)

coveralls commented 10 months ago

Pull Request Test Coverage Report for Build 7009623595


Totals Coverage Status
Change from base Build 7009617504: 0.03%
Covered Lines: 1200
Relevant Lines: 3048

💛 - Coveralls