Skip to content

domain validator fails for fully qualified ("absolute") domain names #124

@mschiffm

Description

@mschiffm
>>> import validators
>>> validators.domain('foo.com')
True
>>> validators.domain('foo.com.')
ValidationFailure(func=domain, args={'value': 'foo.com.'})
>>>

Reference: https://tools.ietf.org/html/rfc1034

When a user needs to type a domain name, the length of each label is
omitted and the labels are separated by dots ("."). Since a complete
domain name ends with the root label, this leads to a printed form which
ends in a dot. We use this property to distinguish between:

  • a character string which represents a complete domain name
    (often called "absolute"). For example, "poneria.ISI.EDU."

  • a character string that represents the starting labels of a
    domain name which is incomplete, and should be completed by
    local software using knowledge of the local domain (often
    called "relative"). For example, "poneria" used in the
    ISI.EDU domain.

Discussion: http://www.dns-sd.org/trailingdotsindomainnames.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIssue/PR: A new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions