Skip to content

Commit

Permalink
Only query host address families over DNS that the local network stac…
Browse files Browse the repository at this point in the history
…k supports (#5176)

* Fix for #5156

* test for #5156

* add changes file

* rearrange if/else

* Revert "rearrange if/else"

This reverts commit a557e4c.

* Revert "test for #5156"

This reverts commit 9d81913.

* Revert "Fix for #5156"

This reverts commit 48de143.

* Add AI_ADDRCONFIG flag to loop.getaddrinfo

* update changes file
  • Loading branch information
derlih authored and webknjaz committed Nov 1, 2020
1 parent 6338c3f commit 17c5138
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/5156.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed querying the address families from DNS that the current host supports.
6 changes: 5 additions & 1 deletion aiohttp/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ async def resolve(
self, hostname: str, port: int = 0, family: int = socket.AF_INET
) -> List[Dict[str, Any]]:
infos = await self._loop.getaddrinfo(
hostname, port, type=socket.SOCK_STREAM, family=family
hostname,
port,
type=socket.SOCK_STREAM,
family=family,
flags=socket.AI_ADDRCONFIG,
)

hosts = []
Expand Down

0 comments on commit 17c5138

Please sign in to comment.