Repository navigation
Accept 62- and 63-character simple hostname labels - #544
Open
Zhuyuyangyy wants to merge 1 commit into
Open
Zhuyuyangyy wants to merge 1 commit into
Zhuyuyangyy wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
hostname("a" * 62)andhostname("a" * 63)returnValidationError, although these are valid single-label hostnames. The rejection also affects ports, optional RFC 1034 trailing dots, andurl(..., simple_host=True).The regex reserves the first and last characters but only allows 59 characters between them, capping labels at 61. Multi-label hostnames already allow 63-character labels. RFC 1035 section 2.3.4 permits 63 octets per label; this regex only accepts ASCII.
Change
Allow up to 61 characters between the first and last label characters. Retain existing character restrictions, hyphen rules, and rejection above 63. Add 28 parameterized boundary cases covering hostnames, ports, optional trailing dots, and URLs with simple hosts enabled.
Validation
This is a focused single-label boundary correction, not a change to domain-name or TLD policy.
AI assistance was used to identify the boundary case, implement the fix, and run the tests.