-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
localhost proxy resolved to IPv6 (in version 2.3.1) #2402
Comments
I pretty sure aiohttp has no changes for it. |
I hit this issue too |
The issue should be fixed by #2424 |
Fixed by #2447 |
That did indeed fix it for me. Thanks! |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
Long story short
I'm using
aiohttp
to make calls via proxy "http://localhost:9999". "etc/hosts" maps localhost to IPv4 and IPv6 addresses.aiohttp
version 2.2.5 resolves that proxy value to "127.0.0.1:9999",aiohttp
version 2.3.1 - to value "::1:9999".I can't pinpoint changes in 2.3.1 that caused this behavior.
I found a workaround, but I think IPv4 should be used by default in this case.
Expected behavior
Proxy "http://localhost:9999" got resolved to "127.0.0.1:9999" (IPv4 is default).
Actual behavior
Proxy "http://localhost:9999" got resolved to "::1:9999" (IPv6 is used for some reason).
Steps to reproduce
As far as I nailed it, line 785 in
connector.py
does host resolution:hosts = yield from self._resolve_host(req.url.raw_host, req.port)
In version 2.2.5
hosts[0]
equals:In version 2.3.1
hosts[0]
equals:(
aiodns
is not used)I've tried to call directly
socket.getaddrinfo
(AFAIK that is the function that does resolution under the hood):family
parameter is the trick, but I'm not modifying it in request code and I don't see where inaiohttp
code it's value changed...Your environment
Linux. Python 3.6.
Contents of /etc/hosts:
(
aiodns
is not used)Workaround
Specify socket family explicitly:
The text was updated successfully, but these errors were encountered: