Opened 9 years ago
Closed 9 years ago
#25637 closed Cleanup/optimization (fixed)
Add label and hostname length validation in URLValidator
Reported by: | Dheerendra Rathor | Owned by: | Raphael Michel |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | zborboa@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Length of labels in hostname (FQDN) should be <= 63 and total length of hostname should be <= 253.
Change History (9)
comment:1 by , 9 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 9 years ago
Summary: | label and hostname length validation in URLValidator → Add label and hostname length validation in URLValidator |
---|
comment:3 by , 9 years ago
Cc: | added |
---|
comment:4 by , 9 years ago
comment:5 by , 9 years ago
63 character limit should be applicable for domain name and TLD regex as well. Total length limit can be implemented by checking the length of host_re
group. Also you should your test in invalid_urls.txt
.
comment:6 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:8 by , 9 years ago
apollo13 asked on IRC whether the same length limits apply for IDN domain names and yes, they do: https://tools.ietf.org/html/rfc5890#section-2.3.2.1
Note:
See TracTickets
for help on using tickets.
The label limit of 64 characters can be done like so:
django/core/validators.py
*[a-z' + ul + r'0-9])?'tests/validators/tests.py
The total length limit seems harder to implement.