aio-libs / aio-libs/aiohttp

aiodns does not work with mDNS and is the default resolver

Đang mở
#10,186 10 bình luận 1 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Python
Star
16.5k
Fork
2.4k
Merge trung bình
17 giờ 22 phút
Pull request đã merge (30 ngày)
212

Mô tả

### Describe the bug

With aiohttp v3.10.10, mDNS hostnames do not resolve when aiodns is installed.

When I force the use of a ThreadedResolver, or when I uninstall aiodns, mDNS hostnames resolve fine.

I see (#8522) that aiodns was made the default resolver again, recently, which explains the regression. The underlying c-ares library has a long-time open request for mDNS support (https://github.com/c-ares/c-ares/issues/171) and no movement over the past few years.

### To Reproduce

You will need a mDNS-resolvable service for this to work. (If you have avahi-daemon installed, your hostname with a .local suffix should suffice.)

```
>>> import aiohttp
>>> import asyncio
>>> async def main():
... async with aiohttp.ClientSession() as session:
... async with session.get('http://some_mdns_hostname.local') as resp:
... print(resp.status)
... print(await resp.text())
>>>asyncio.run(main())
ClientConnectorDNSError: Cannot connect to host rfmux0033.local:80 ssl:default [Domain name not found]
```

### Expected behavior

Correct resolution of the hostname via mDNS.

### Logs/tracebacks

```python-traceback
ClientConnectorDNSError: Cannot connect to host some_mdns_hostname.local:80 ssl:default [Domain name not found]
```

### Python Version

```console
$ python --version
Python 3.12.8
```

### aiohttp Version

```console
aiohttp.__version__
'3.10.10'
```

### multidict Version

```console
multidict.__version__
'6.1.0'
```

### propcache Version

```console
Not installed.
```

### yarl Version

```console
yarl.__version__
'1.13.1'
```

### OS

Debian Linux (testing)

### Related component

Client

### Additional context

_No response_

### Code of Conduct

- [X] I agree to follow the aio-libs Code of Conduct

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.