Commit e87578d
committed
Update vendored httpx-ws to upstream v0.9.0 (0341891)
The initial vendoring in #1042 accidentally used frankie567/httpx-ws@6bc568b
(v0.6.2 era, October 2024), missing 80 upstream commits. This ports every
upstream change from that point to the current tip, frankie567/httpx-ws@0341891
(v0.9.0 + 6 commits). See discussion #1066.
Highlights:
- Serialize stream writes with a write lock (httpx-ws#29)
- Rebuild the async session on anyio.AsyncContextManagerMixin, fixing the
asyncio hang on exit after cancellation and cancel scope corruption
(httpx-ws#108); requires anyio>=4.10
- Rewrite ASGIWebSocketTransport on a task group and anyio streams instead of
a blocking portal and queue.Queue
- Support the WebSocket Denial Response ASGI extension
- Add a configurable initial_receive_timeout with a clear error when the
server never accepts
- Raise TimeoutError instead of queue.Empty on sync receive timeout
- Handle end of stream and closing-state keepalive pings properly
- Add class-based WebSocketClient/AsyncWebSocketClient with session_class
support (kept off connect_ws/aconnect_ws, where mypy cannot infer the
TypeVar default through the contextmanager decorator)
Two fixes not in upstream: register aclose before the initial receive so a
never-accepting app does not leak memory object streams, and cover the
double-__aenter__ guard with a test.1 parent 95aebc3 commit e87578d
9 files changed
Lines changed: 894 additions & 345 deletions
File tree
- docs
- src/httpx2
- httpx2/websockets
- tests/httpx2/websockets
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
8 | 14 | | |
9 | 15 | | |
10 | 16 | | |
| |||
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
| 25 | + | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
| 29 | + | |
22 | 30 | | |
23 | 31 | | |
24 | 32 | | |
| |||
0 commit comments