-
Notifications
You must be signed in to change notification settings - Fork 284
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
Use getaddrinfo and parse /etc/hosts on linux #460
Conversation
TODO: for windows, look at \WINDOWS\system32\drivers\etc\hosts
…consistent with .resolveHost. Fixes #430.
This is great! I didn't know that |
Note that for windows, hosts file is in \windows\system32\drivers\etc\hosts. I wasn't sure how to get that path in the canonical way, so I didn't implement it. |
Actually, rather than base_load_hosts, it's probably better to call |
I've hard-coded the "C:\Windows..." path as a first step and will just use the Thanks for the additional |
This PR was already integrated into master manually and can be closed. |
The motivation for this change is that my application needs /etc/hosts to be parsed and used.
So I changed usage of evdns_base_resolve_ipv4/ipv6 to getaddrinfo, because evdns_base_resolve_XXX doesn't use the hosts file.
You may be wondering why I then applied a commit "Change EventDriver.resolveHost parameter..." The answer is that I can't compile the current master HEAD (see #458). So I branched from the most recent commit that compiles for me, and made my changes. Then I cherry picked d49f615 and resolved conflicts.
So far I've only tested with an /etc/hosts containing localhost. Tomorrow I will test with a more challenging /etc/hosts file that maps nameFoo to 127.0.0.1 and nameBar to a remote IP. I have every reason to believe it will work.