Repository navigation
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.
The
idn-hostnameformat (draft 07 and 2019-09) rejects most internationalized host names, which is what the format is for:The regex only allowed ASCII letters and digits, needed exactly two or three labels, allowed
_, and ended with$.The fix uses the same shape as the
hostnameregex (labels of 1-63 chars, no-at the start or end, joined by dots,\Zat the end), but a letter or digit can be any Unicode letter or digit ([^\W_]), and combining marks of common scripts (Latin diacritics, Hebrew, Arabic, Indic, Thai, ...) are allowed after the first character, soहिन्दी.भारतworks. Punctuation, symbols and spaces stay out, also the fullwidth ones:evil.com,example.com/pathanduser@example.comare rejected, since they turn into.,/and@after NFKC. It stays a "good enough" regex like the other formats: IDNA2008 context rules (ZWJ, middle dot, bidi, ...) are not checked, so that suite file stays ignored.Against the latest JSON-Schema-Test-Suite
format-idn-hostname.json(draft 7), valid names that are rejected go from 36 to 18 (the rest need context-rule characters such as U+00B7 or U+30FB). Invalid names that are accepted go from 1 to 14; those are context-rule cases, which passed before only because every non-ASCII name was rejected.Tests:
test_idn_hostnameintests/test_format.py(fails on master), plus a long-input timing case.make test: 5588 passed. pylint score unchanged. Added a CHANGELOG line.