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

Update cleanHostValue so it never returns invalid hostname characters #60

Merged
merged 1 commit into from
Sep 17, 2015

Conversation

myndzi
Copy link
Collaborator

@myndzi myndzi commented Jun 25, 2015

No description provided.

@myndzi
Copy link
Collaborator Author

myndzi commented Jun 25, 2015

This should fix the remaining case for #54.

URL.parse strangely allows + in hostnames, but as far as I can tell, they're not acceptable for regular hostnames (as used in DNS and the web at large), and they are special in regex, so I've excluded them. cleanHostValue will now only return strings that contain entirely valid hostname characters, or the empty string. This fixes the above case, passes all the tests, and seems sane; it still uses url.parse for parsing, so there is a possible edge case where a hostname including '+' will get successfully parsed by url.parse but will be returned as invalid/empty from cleanHostValue.

thom4parisot pushed a commit that referenced this pull request Sep 17, 2015
Update cleanHostValue so it never returns invalid hostname characters
@thom4parisot thom4parisot merged commit 2593cd0 into thom4parisot:master Sep 17, 2015
@thom4parisot
Copy link
Owner

Quite subtle, thanks :-)

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.

2 participants