Comment 12 for bug 1492621

Revision history for this message
In , Tore Anderson (toreanderson) wrote :

getaddrinfo() will disregard the loopback addresses ::1 and 127.0.0.1 when attempting to figure out which address families are present on the host, when being called with the AI_ADDRCONFIG flag.

This makes a lot of sense when looking up an external hostname. However, it makes very little sense when connecting to the hostname "localhost". I've learned that the browser vendors will avoid using AI_ADDRCONFIG or do it while using workarounds for the localhost case, see for instance:

https://bugzilla.mozilla.org/show_bug.cgi?id=614526

Without such a workaround, connecting to a IPv4-only service listening on 127.0.0.1 using the hostname "localhost" will fail unless the machine also has external IPv4 connectivity. Which is not what a user would expect, since the (lack of) external connectivity is irrelevant to the accessibility to the loopback interface.

Therefore, when looking up "localhost", the loopback addresses ::1 and 127.0.0.1 should not be ignored by getaddrinfo() when using AI_ADDRCONFIG

Tore