ocaml-dns icon indicating copy to clipboard operation
ocaml-dns copied to clipboard

Should Ptr.t use raw domain names?

Open samoht opened this issue 3 months ago • 2 comments

Currently, Ptr.t has type [ 'host ] Domain_name.t, but I think that the PTR data is supposed to be domain names. The hostname validation breaks DNS-SD where PTR targets contain spaces:

_hap._tcp.local. PTR My Device._hap._tcp.local.

Cname.t is already [ 'raw ]. Ptr and I suspect we should do the same for PTR:

module Ptr = struct
  type t = [ `raw ] Domain_name.t
  let decode names buf ~off ~len:_ = Name.decode names buf ~off
end

Users can call Domain_name.host explicitly if they need hostname validation.

samoht avatar Dec 02 '25 16:12 samoht

Indeed that may be sensible. May I ask what kind of service you're using ocaml-dns with dns-sd, resolver, client, or server?

hannesm avatar Dec 02 '25 17:12 hannesm

I'm using it on the client side, for the homekit (hap) and matter protocols.

samoht avatar Dec 02 '25 20:12 samoht