-
Notifications
You must be signed in to change notification settings - Fork 84
Improve checking entries in the hostfile #38
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, it's a really great bugfix. It's ready to merge as-is, but I have one recommendation about making it even more solid. Let me know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like pretty solid code, but I'm not 100% sure it'll work for all possible hostfile contents, such as tab characters, different encodings, or comments. Maybe it would be easier to bring in a tool like https://www.npmjs.com/package/hostile which has a well-tested hostfile parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a pretty quick and dirty way of improving the checking. Your are right that can be fooled by domains in comments, which the previous code had a problem with as well. I'll take a look hostile and see what that looks like to bring in.
Bumps [@types/rimraf](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/rimraf) from 2.0.4 to 3.0.0. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/rimraf) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Currently the host file check will not add a domain if a subdomain of that domain already exists.
For example if the host file contains
127.0.0.1 sub.example.comand the user is setting upexample.comit will be skipped and not added to the hostfile.