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

Allow hyphens anywhere in URL hostnames #69

Merged
merged 1 commit into from
Dec 17, 2018

Conversation

sideshowbarker
Copy link
Contributor

@sideshowbarker sideshowbarker commented Dec 17, 2018

This change brings galimatias’s ToASCII and ToUnicode behavior into conformance with the current URL spec, which requires the ToASCII and ToUnicode algorithms to be performed with the CheckHyphens flag set to false — which means that hyphens are allowed anywhere in the URL hostname, including leading and trailing hyphens.

Fixes validator/validator#720 Thanks @KatieMFritz

This change brings galimatias’s ToASCII and ToUnicode behavior into
conformance with the current URL spec, which requires the ToASCII and
ToUnicode algorithms to be performed with the CheckHyphens flag set to
false — which means that hyphens are allowed anywhere in the URL
hostname, including leading and trailing hyphens.

Fixes validator/validator#720 Thanks @KatieMFritz
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 87.579% when pulling c1d463b on validator:allow-hyphens-in-hostnames into 1e647f6 on smola:master.

@smola
Copy link
Owner

smola commented Dec 17, 2018

@sideshowbarker Could you add a test?

@sideshowbarker
Copy link
Contributor Author

@sideshowbarker Could you add a test?

Sure. Where should it go? In urltestdata_host_whatwg.txt or instead in ParseIssueTest.java?

@smola
Copy link
Owner

smola commented Dec 17, 2018

@sideshowbarker Right into ParseIssueTest, as a new test that actually checks the exception message.
(urltestdata_host_whatwg.txt will be removed and replaced with latest official version without modifications).

@sideshowbarker
Copy link
Contributor Author

@sideshowbarker Right into ParseIssueTest, as a new test that actually checks the exception message.

OK, but now I’m not sure how to write a test for this case — because with this patch applied, if a URL has a hostname containing a leading hyphen or trailing hyphen, then no exception will be thrown.

So does the current test harness have any existing ”this URL should cause not exceptions” test cases? (So that I can use an existing test case as an example for writing the one needed here.)

@smola
Copy link
Owner

smola commented Dec 17, 2018

@sideshowbarker Ok, don't worry, I'm in the process of adding such tests. So will add it one for this PR shortly. Merging.

@smola smola merged commit 242ae66 into smola:master Dec 17, 2018
@sideshowbarker sideshowbarker deleted the allow-hyphens-in-hostnames branch December 17, 2018 16:47
@smola smola mentioned this pull request Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants