reactphp-legacy/socket-client

Does not honor /etc/hosts

Closed this issue · 7 comments

clue commented

There's currently no way to connect to "localhost" or any other host names listed in the local /etc/hosts file. We could provide a hard-coded default for some common host names (like "localhost"), but this is bound to break.

In particular, this also affects usage with linked Docker containers where one container references another container by its host name. This means that there's currently no way to connect to other containers by their name.

Opening this ticket as a reminder - this actually depends on reactphp/dns#10

Isn't it possible to make the DNS dependency optional? I have a custom DNS server, and I don't want my application to be bound by its IP – this would mean headache for the maintainers of my code. :)

clue commented

Isn't it possible to make the DNS dependency optional?

I agree with your suggestion, but it's probably unrelated to this ticket. Have you seen #12 yet? :)

Ah. What I meant was, making that dependency optional will fix this issue, as well. If I either create a non-resolving connector or pass in a NullResolver, then things in /etc/hosts would be resolved with no problems, right?

Also see #7. If you want to finish that PR to have a NullResolver as commented that could move this along.

Thanks a lot. Will see if I can wrap my head around it and finish it :-)

clue commented

If I either create a non-resolving connector or pass in a NullResolver, then things in /etc/hosts would be resolved with no problems, right?

Not quite :) #12 (and #7 and #46) only deal with making the DNS resolver optional. This means that NO DNS lookups whatsoever will be performed and as such only IPs can be used.

This ticket here discusses introducing a new feature to take the hosts file into account so that the host names listed there will actually be resolved. This should probably still be part of the DNS component, so this depends on reactphp/dns#10.

clue commented

Closed in favor of reactphp/socket#88 (Migrating over to Socket now that #86 is in)