Skip to content
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

Allow escape of dot in instance name #179

Merged
merged 3 commits into from Apr 11, 2019

Conversation

Projects
None yet
4 participants
@mattiasbe
Copy link
Contributor

commented Dec 14, 2018

Allow dots in instance names as per rfc 6763. According to rfc6763 instance names are allowed to contain any characters, including dots. They recommend escaping them if concatenating all the parts internally.

See section 4.3:
”4.3. Internal Handling of Names”
https://github.com/jmdns/jmdns/blob/master/devdocs/txt/rfc6763.txt

Also see this from avahi:
“Notes on DNS Name Escaping”
https://code.woboq.org/qt5/include/avahi-compat-libdns_sd/dns_sd.h.html

The reason for this requested support is that the European ITxPT public transport standard is using an additional extra field in the instance containing the separator dot.

While the loop with the separate fields could use a string split with a regexp instead this pull request preserves the code flow as it currently stands.
Otherwise a suggested change could be to split up the concatenated FQDN (aName) with this:
String[] nameParts = name.split("(?<!\\\\)\\."); // negative look behind, look for \\. (escaped regexp .) without a preceding backslash.

A complete change should involve checking for (replacing) a double backslash as well. Maybe simply changing line 128 with an additional replace:
aName.substring(0, n).replace("\\.", ".").replace("\\\\", "\\");

Allow escape of dot in instance name
Allow dots in service names as per rfc 6763. According to rfc6763 instance names are allowed to contain any characters, including dots. They recommend escaping them if concatenating all the parts internally. See section 4.3
Allow escape of dot in instance name
Allow dots in service names as per rfc 6763. According to rfc6763 instance names are allowed to contain any characters, including dots. They recommend escaping them if concatenating all the parts internally. See section 4.3

Signed-off-by: mattias <mattias.bergander@gmail.com>
@zippozeng

This comment has been minimized.

Copy link
Contributor

commented Dec 19, 2018

good job

Merge branch 'allow-dot-escape' of https://github.com/mattiasbe/jmdns
…into allow-dot-escape

Signed-off-by: mattias <mattias.bergander@gmail.com>

@mattiasbe mattiasbe force-pushed the mattiasbe:allow-dot-escape branch from 7bb232f to 1e30f83 Jan 26, 2019

@axlsml

This comment has been minimized.

Copy link

commented Apr 10, 2019

I confirm this is a working and required fix for ITxPT protocol. Thanks.
A merge to public master would be nice 👍

@kaikreuzer
Copy link
Member

left a comment

Many thanks @mattiasbe for the detailed description and the fix!

@kaikreuzer kaikreuzer merged commit d15acaf into jmdns:master Apr 11, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.