-
Notifications
You must be signed in to change notification settings - Fork 71
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
Underscores in subdomains? #134
Comments
Ditto, |
Sure 👍 While doing a quick research, I just stumbled upon https://stackoverflow.com/a/2183140 Anyway, you can send my a PR adding |
I changed my mind. I'm going to allow 2 different validation modes: export enum Validation {
/**
* Allows any octets as labels
* but still restricts the length of labels and the overall domain.
*
* @see https://www.rfc-editor.org/rfc/rfc2181#section-11
**/
Lax = "LAX",
/**
* Only allows ASCII letters, digits and hyphens (aka LDH),
* forbids hyphens at the the beginning or end of a label
* and requires top-level domain names not to be all-numeric.
*
* This is the default if no validation is configured.
*
* @see https://datatracker.ietf.org/doc/html/rfc3696#section-2
*/
Strict = "STRICT",
} What do you think? |
i like the idea, STRICT being the default? |
Shipped with v5.0.0 🚀 import { parseDomain, Validation } from "parse-domain";
const parseResult = parseDomain("_jabber._tcp.gmail.com", {
validation: Validation.Lax,
}); |
Are you interested in supporting underscores in subdomains? They are quite legal and somewhat common, and this lib (like many) throws an unsupported character error in such cases.
I have a rough fix in my fork, I can PR if you want.
The text was updated successfully, but these errors were encountered: