Skip to content

domain validators allows underscores #340

Closed

Description

@Diman0
>>> import validators
>>> validators.domain('ex_ample.com')
True

The domain validator allows underscores in the name while this is illegal.

See page 8 of rfc1035

The labels must follow the rules for ARPANET host names. They must
start with a letter, end with a letter or digit, and have as interior
characters only letters, digits, and hyphen. There are also some
restrictions on the length. Labels must be 63 characters or less.

or wikipedia

A domain name consists of one or more labels, each of which is formed from the set of ASCII letters, digits, and hyphens (a–z, A–Z, 0–9, -), but not starting or ending with a hyphen. The labels are case-insensitive; for example, 'label' is equivalent to 'Label' or 'LABEL'. In the textual representation of a domain name, the labels are separated by a full stop (period).

Activity

  1. nandgator commented on Mar 22, 2024

    @nandgator
    Collaborator

    rfc_2782 talks about prepending underscores.

    This document obsoletes RFC 2052. The major change from that
    previous, experimental, version of this specification is that now the
    protocol and service labels are prepended with an underscore, to
    lower the probability of an accidental clash with a similar name used
    for unrelated purposes.

    The symbolic name of the desired service, as defined in Assigned
    Numbers [STD 2] or locally. An underscore (_) is prepended to
    the service identifier to avoid collisions with DNS labels that
    occur in nature.

    The symbolic name of the desired protocol, with an underscore
    (_) prepended to prevent collisions with DNS labels that occur
    in nature.

    Also, even if not a "standard" most modern browsers allow it.

    Refer:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    expectedIssue: Works as designed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions