latch-asgi 1.0.6.dev3__py3-none-any.whl → 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- latch_asgi/context/websocket.py +2 -46
- latch_asgi/framework/common.py +0 -1
- {latch_asgi-1.0.6.dev3.dist-info → latch_asgi-1.1.0.dist-info}/METADATA +2 -2
- {latch_asgi-1.0.6.dev3.dist-info → latch_asgi-1.1.0.dist-info}/RECORD +7 -7
- {latch_asgi-1.0.6.dev3.dist-info → latch_asgi-1.1.0.dist-info}/WHEEL +1 -1
- {latch_asgi-1.0.6.dev3.dist-info → latch_asgi-1.1.0.dist-info}/entry_points.txt +0 -0
- {latch_asgi-1.0.6.dev3.dist-info → latch_asgi-1.1.0.dist-info}/licenses/COPYING +0 -0
latch_asgi/context/websocket.py
CHANGED
|
@@ -27,53 +27,9 @@ class Context(
|
|
|
27
27
|
|
|
28
28
|
@trace_app_function
|
|
29
29
|
async def accept_connection(
|
|
30
|
-
self: Self,
|
|
31
|
-
*,
|
|
32
|
-
subprotocol: str | None = None,
|
|
33
|
-
headers: Headers | None = None,
|
|
34
|
-
negotiate_permessage_deflate: bool = False,
|
|
30
|
+
self: Self, *, subprotocol: str | None = None, headers: Headers | None = None
|
|
35
31
|
) -> None:
|
|
36
|
-
|
|
37
|
-
await accept_connection(self.send, subprotocol=subprotocol, headers=headers)
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
offer = self.header_str("sec-websocket-extensions")
|
|
41
|
-
|
|
42
|
-
headers_out: Headers = {}
|
|
43
|
-
if headers is not None:
|
|
44
|
-
headers_out = dict(headers)
|
|
45
|
-
|
|
46
|
-
def _has_extensions_header(h: Headers) -> bool:
|
|
47
|
-
for k in h.keys():
|
|
48
|
-
if isinstance(k, bytes):
|
|
49
|
-
if k.decode("latin-1").lower() == "sec-websocket-extensions":
|
|
50
|
-
return True
|
|
51
|
-
else:
|
|
52
|
-
if k.lower() == "sec-websocket-extensions":
|
|
53
|
-
return True
|
|
54
|
-
return False
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
offer is not None
|
|
58
|
-
and "permessage-deflate" in offer.replace(" ", "").lower()
|
|
59
|
-
and not _has_extensions_header(headers_out)
|
|
60
|
-
):
|
|
61
|
-
# Minimal negotiation: if the client offered client_max_window_bits without a value,
|
|
62
|
-
# reply with a concrete value to satisfy browsers like Chrome.
|
|
63
|
-
offer_no_space = offer.replace(" ", "").lower()
|
|
64
|
-
if (
|
|
65
|
-
"client_max_window_bits" in offer_no_space
|
|
66
|
-
and "client_max_window_bits=" not in offer_no_space
|
|
67
|
-
):
|
|
68
|
-
headers_out["Sec-WebSocket-Extensions"] = (
|
|
69
|
-
"permessage-deflate; client_max_window_bits=15"
|
|
70
|
-
)
|
|
71
|
-
else:
|
|
72
|
-
headers_out["Sec-WebSocket-Extensions"] = "permessage-deflate"
|
|
73
|
-
|
|
74
|
-
await accept_connection(
|
|
75
|
-
self.send, subprotocol=subprotocol, headers=headers_out or headers
|
|
76
|
-
)
|
|
32
|
+
await accept_connection(self.send, subprotocol=subprotocol, headers=headers)
|
|
77
33
|
|
|
78
34
|
@trace_app_function
|
|
79
35
|
async def receive_message(self: Self, cls: type[T]) -> T:
|
latch_asgi/framework/common.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: latch-asgi
|
|
3
|
-
Version: 1.0
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: ASGI python server
|
|
5
5
|
Author-Email: Max Smolin <max@latch.bio>
|
|
6
6
|
License: CC0-1.0
|
|
7
7
|
Requires-Python: <4.0,>=3.11
|
|
8
8
|
Requires-Dist: hypercorn[uvloop]<1.0.0,>=0.14.3
|
|
9
9
|
Requires-Dist: latch-data-validation<1.0.0,>=0.1.3
|
|
10
|
-
Requires-Dist: latch-o11y<
|
|
10
|
+
Requires-Dist: latch-o11y<2.0.0,>=1.2.0
|
|
11
11
|
Requires-Dist: latch-config<1.0.0,>=0.1.6
|
|
12
12
|
Requires-Dist: PyJWT[crypto]<3.0.0,>=2.6.0
|
|
13
13
|
Requires-Dist: orjson<4.0.0,>=3.8.5
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
latch_asgi-1.0.
|
|
2
|
-
latch_asgi-1.0.
|
|
3
|
-
latch_asgi-1.0.
|
|
4
|
-
latch_asgi-1.0.
|
|
1
|
+
latch_asgi-1.1.0.dist-info/METADATA,sha256=iubtdw2c_aw5rA7TmE1lvwgedj5C-bZWaZTbodL93ss,580
|
|
2
|
+
latch_asgi-1.1.0.dist-info/WHEEL,sha256=Wb0ASbVj8JvWHpOiIpPi7ucfIgJeCi__PzivviEAQFc,90
|
|
3
|
+
latch_asgi-1.1.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
|
|
4
|
+
latch_asgi-1.1.0.dist-info/licenses/COPYING,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
|
|
5
5
|
latch_asgi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
6
|
latch_asgi/asgi_iface.py,sha256=JSmp9YnbcU7MymDcqo7DvIGGyP5wZWe-8QNtAtkgJnc,2199
|
|
7
7
|
latch_asgi/auth.py,sha256=XG4lfgpiu88bAcXa_brGeadDn6BlQH8f_swKwv7Jqag,5874
|
|
@@ -9,12 +9,12 @@ latch_asgi/config.py,sha256=Tt3fj4sOz6TENfSIWI5_1fZM1aomIu9xQk4kfw4xDXA,276
|
|
|
9
9
|
latch_asgi/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
latch_asgi/context/common.py,sha256=8Mc1kaQoD0JUAkxD9URFOK4SFE8deJgJ1CroytbuV_Y,2654
|
|
11
11
|
latch_asgi/context/http.py,sha256=dz9bB6ZDG7yMP3cVQVFBw-fXu5Nt2ErDhRPXGFy6GS0,959
|
|
12
|
-
latch_asgi/context/websocket.py,sha256=
|
|
12
|
+
latch_asgi/context/websocket.py,sha256=ERyy3CXhXwNMuMVo2sUNrYAga5nt9847BrEAMox2Ga0,1486
|
|
13
13
|
latch_asgi/datadog_propagator.py,sha256=tmFWHhsVZ9ClNDWkAz2SLym0almUekz9AwCrdzQaLU4,3346
|
|
14
14
|
latch_asgi/framework/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
|
-
latch_asgi/framework/common.py,sha256=
|
|
15
|
+
latch_asgi/framework/common.py,sha256=GylhWwlwjF15qAN_ZYn8QC2Dtn7hyd8HnT77Ktba0w4,815
|
|
16
16
|
latch_asgi/framework/http.py,sha256=mAZJrsYUPyh3PHt-IL3AEc4bNG1z3Sq8a7mA4o3fPZ0,4853
|
|
17
17
|
latch_asgi/framework/websocket.py,sha256=KaRiGGXb635R0U3m_dm9nIT5iWYEWel1IH000MHN3t0,8017
|
|
18
18
|
latch_asgi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
latch_asgi/server.py,sha256=Gg1ZUm7LCRgYXUjyIDn6TuZTXSGYk1jUM20ZWC-fseY,18418
|
|
20
|
-
latch_asgi-1.0.
|
|
20
|
+
latch_asgi-1.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|