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

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

Closed
mschiffm opened this issue Aug 11, 2019 · 2 comments · Fixed by #231
Closed

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

mschiffm opened this issue Aug 11, 2019 · 2 comments · Fixed by #231
Labels
enhancement Issue/PR: A new feature

Comments

@mschiffm
Copy link

>>> 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

@ramiroestrada
Copy link

I've recently run into this issue and actually want it to fail on those with a trailing dot. Perhaps a configurable parameter to allow us to determine how to react to such entries

validators.domain('foo.com.', trailingdots=True)

also consider this in URLs:

validators.url('http://foo.com./content', trailingdots=True)

@fili
Copy link

fili commented Apr 3, 2020

As @mschiffm mentioned, the trailing dot is default allowed, so if you want to make it optional then the failing should be optional:

validators.url('http://foo.com./content', trailingdots=False)

@yozachar yozachar added the enhancement Issue/PR: A new feature label Mar 2, 2023
yozachar added a commit to yozachar/pyvalidators that referenced this issue Mar 2, 2023
yozachar added a commit to yozachar/pyvalidators that referenced this issue Mar 2, 2023
- Uses type hints, improve docs
- Regards [RFC 1034](https://www.rfc-editor.org/rfc/rfc1034)
- Updates corresponding test functions

**Related items**

*Issues*

- Closes python-validators#52
- Closes python-validators#74
- Closes python-validators#81
- Closes python-validators#89
- Closes python-validators#95
- Closes python-validators#120
- Closes python-validators#124
- Closes python-validators#141
- Closes python-validators#143
- Closes python-validators#199
- Closes python-validators#204

*PRs*

- Closes python-validators#114
yozachar added a commit to yozachar/pyvalidators that referenced this issue Mar 2, 2023
- Uses type hints, improve docs
- Regards [RFC 1034](https://www.rfc-editor.org/rfc/rfc1034) and [RFC 2782](https://www.rfc-editor.org/rfc/rfc2782)
- Updates corresponding test functions

**Related items**

*Issues*

- Closes python-validators#52
- Closes python-validators#74
- Closes python-validators#81
- Closes python-validators#89
- Closes python-validators#95
- Closes python-validators#120
- Closes python-validators#124
- Closes python-validators#141
- Closes python-validators#143
- Closes python-validators#199
- Closes python-validators#204

*PRs*

- Closes python-validators#114
- Closes python-validators#179
yozachar added a commit to yozachar/pyvalidators that referenced this issue Mar 2, 2023
- Uses type hints, improve docs
- Regards [RFC 1034](https://www.rfc-editor.org/rfc/rfc1034) and [RFC 2782](https://www.rfc-editor.org/rfc/rfc2782)
- Updates corresponding test functions

**Related items**

*Issues*

- Closes python-validators#52
- Closes python-validators#74
- Closes python-validators#81
- Closes python-validators#89
- Closes python-validators#95
- Closes python-validators#120
- Closes python-validators#124
- Closes python-validators#141
- Closes python-validators#143
- Closes python-validators#199
- Closes python-validators#204

*PRs*

- Closes python-validators#114
- Closes python-validators#179
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issue/PR: A new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants