-
Notifications
You must be signed in to change notification settings - Fork 56
feat: implement RFC 6763 Section 4.3 escaping for instance names #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: implement RFC 6763 Section 4.3 escaping for instance names #420
Conversation
Add proper escaping of dots and backslashes in DNS-SD instance names according to RFC 6763 Section 4.3: - '.' becomes '\.' - '\' becomes '\\' This ensures that literal dots in instance names (e.g., "My.Service") are not interpreted as DNS label separators when constructing the Service Instance Name. Fixes improper handling of instance names containing dots or backslashes.
c515d2e to
13a7bf7
Compare
|
The description section seems to be missing backslash in these:
I think it's because of Markdown syntax, and should use ``, not '' for them. |
keepsimple1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR! LGTM, only a couple of minor comments inline.
|
|
||
| /// Escapes dots and backslashes in a DNS instance name according to RFC 6763 Section 4.3. | ||
| /// - '.' becomes '\.' | ||
| /// - '\\' becomes '\\\\' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Because \ has to be escaped in the code representation, these two examples are not consistent:
either change the first line to: . becomes \\.
or change the 2nd line to: \ becomes \\
| // etc. | ||
| // | ||
| // This function also handles RFC 6763 Section 4.3 escaping where dots and backslashes | ||
| // in instance names are escaped (e.g., "My\\.Service" represents a single label "My.Service"). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify possible confusions, could you please add something like: "Name sent over the wire is unescaped, for example My.Service". )
| /// `ty_domain` is the service type and the domain label, for example | ||
| /// "_my-service._udp.local.". | ||
| /// | ||
| /// `my_name` is the instance name, without the service type suffix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please help add a bit here to describe that my_name now allows . or \\ in it?
|
Another small thing: could you please explicitly refer to the issue number in this PR description? |
Add proper escaping of dots and backslashes in DNS-SD instance names according to RFC 6763 Section 4.3:
This ensures that literal dots in instance names (e.g., "My.Service") are not interpreted as DNS label separators when constructing the Service Instance Name.
Fixes improper handling of instance names containing dots or backslashes.