aio-libs / aio-libs/aiohttp

Unix domain sockets: Extend documentation & support base_url

オープン
#11,324 コメント 3 件 リアクション 2 件 担当者 0 名 GitHub で見る
enhancement
主要言語
Python
スター
16.5k
フォーク
2.4k
平均マージ
17時間 22分
マージ済み PR(30日)
212

説明

### Is your feature request related to a problem?

1) The [docs](https://docs.aiohttp.org/en/stable/client_advanced.html#unix-domain-sockets) mention briefly how to connect to a server using unix domain dockets but there's no example of how a valid url should look like. In other words, given `aiohttp.UnixConnector(path='/path/to/socket')`, what's the equivalent url of http://httpbin.org/get?

After some trial and error, here's what doesn't work and what does:
- ❌ `get`: `InvalidUrlClientError`
- ❌ `/get`: `InvalidUrlClientError`
- ❌ `///get`: `InvalidUrlClientError`
- ❌ `//get`: 404 not found - the server receives `/`
- ❌ All the above prepended by explicit `unix:` scheme
- ✅ `//localhost/get` (and `unix://localhost/get`): works
- ✅ `//can-be-anything:12345/get`: works but should it? Apparently host/port are ignored but they're still required.

2) After eventually finding a url that works, I tried to set a base_url to `unix://localhost` (or `unix://localhost/`) so that I can pass just the relative url (`get`). Sadly this also raises `InvalidUrlClientError`

### Describe the solution you'd like

1. Extend the documentation to show valid unix domain socket urls look like
2. Support `base_url` for unix domain sockets

### Related component

Client

### Code of Conduct

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。