python-engineio 4.13.1__py3-none-any.whl → 4.13.2__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.
- engineio/async_drivers/aiohttp.py +3 -1
- engineio/async_drivers/asgi.py +12 -13
- engineio/async_server.py +2 -1
- engineio/async_socket.py +4 -2
- engineio/base_socket.py +4 -1
- engineio/server.py +2 -1
- engineio/socket.py +4 -2
- {python_engineio-4.13.1.dist-info → python_engineio-4.13.2.dist-info}/METADATA +1 -1
- {python_engineio-4.13.1.dist-info → python_engineio-4.13.2.dist-info}/RECORD +12 -12
- {python_engineio-4.13.1.dist-info → python_engineio-4.13.2.dist-info}/WHEEL +1 -1
- {python_engineio-4.13.1.dist-info → python_engineio-4.13.2.dist-info}/top_level.txt +0 -0
- {python_engineio-4.13.1.dist-info → python_engineio-4.13.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -79,11 +79,13 @@ class WebSocket: # pragma: no cover
|
|
|
79
79
|
"""
|
|
80
80
|
def __init__(self, handler, server):
|
|
81
81
|
self.handler = handler
|
|
82
|
+
self.server = server
|
|
82
83
|
self._sock = None
|
|
83
84
|
|
|
84
85
|
async def __call__(self, environ):
|
|
85
86
|
request = environ['aiohttp.request']
|
|
86
|
-
self._sock = WebSocketResponse(
|
|
87
|
+
self._sock = WebSocketResponse(
|
|
88
|
+
max_msg_size=self.server.max_http_buffer_size)
|
|
87
89
|
await self._sock.prepare(request)
|
|
88
90
|
|
|
89
91
|
self.environ = environ
|
engineio/async_drivers/asgi.py
CHANGED
|
@@ -136,10 +136,18 @@ class ASGIApp:
|
|
|
136
136
|
|
|
137
137
|
async def translate_request(scope, receive, send):
|
|
138
138
|
class AwaitablePayload: # pragma: no cover
|
|
139
|
-
def __init__(self,
|
|
140
|
-
self.
|
|
139
|
+
def __init__(self, event):
|
|
140
|
+
self.event = event
|
|
141
|
+
self.payload = None
|
|
141
142
|
|
|
142
143
|
async def read(self, length=None):
|
|
144
|
+
if self.payload is None and event['type'] == 'http.request':
|
|
145
|
+
# read payload from http request
|
|
146
|
+
self.payload = self.event.get('body') or b''
|
|
147
|
+
while self.event.get('more_body'):
|
|
148
|
+
self.event = await receive()
|
|
149
|
+
if self.event['type'] == 'http.request':
|
|
150
|
+
self.payload += self.event.get('body') or b''
|
|
143
151
|
if length is None:
|
|
144
152
|
r = self.payload
|
|
145
153
|
self.payload = b''
|
|
@@ -149,16 +157,7 @@ async def translate_request(scope, receive, send):
|
|
|
149
157
|
return r
|
|
150
158
|
|
|
151
159
|
event = await receive()
|
|
152
|
-
|
|
153
|
-
if event['type'] == 'http.request':
|
|
154
|
-
payload += event.get('body') or b''
|
|
155
|
-
while event.get('more_body'):
|
|
156
|
-
event = await receive()
|
|
157
|
-
if event['type'] == 'http.request':
|
|
158
|
-
payload += event.get('body') or b''
|
|
159
|
-
elif event['type'] == 'websocket.connect':
|
|
160
|
-
pass
|
|
161
|
-
else:
|
|
160
|
+
if event['type'] not in ['http.request', 'websocket.connect']:
|
|
162
161
|
return {}
|
|
163
162
|
|
|
164
163
|
raw_uri = scope['path']
|
|
@@ -171,7 +170,7 @@ async def translate_request(scope, receive, send):
|
|
|
171
170
|
else:
|
|
172
171
|
raw_uri += '?' + query_string
|
|
173
172
|
environ = {
|
|
174
|
-
'wsgi.input': AwaitablePayload(
|
|
173
|
+
'wsgi.input': AwaitablePayload(event),
|
|
175
174
|
'wsgi.errors': sys.stderr,
|
|
176
175
|
'wsgi.version': (1, 0),
|
|
177
176
|
'wsgi.async': True,
|
engineio/async_server.py
CHANGED
|
@@ -462,7 +462,6 @@ class AsyncServer(base_server.BaseServer):
|
|
|
462
462
|
'maxPayload': self.max_http_buffer_size,
|
|
463
463
|
})
|
|
464
464
|
await s.send(pkt)
|
|
465
|
-
s.schedule_ping()
|
|
466
465
|
|
|
467
466
|
ret = await self._trigger_event('connect', sid, environ,
|
|
468
467
|
run_async=False)
|
|
@@ -471,6 +470,8 @@ class AsyncServer(base_server.BaseServer):
|
|
|
471
470
|
self.logger.warning('Application rejected connection')
|
|
472
471
|
return self._unauthorized(ret or None)
|
|
473
472
|
|
|
473
|
+
s.schedule_ping()
|
|
474
|
+
|
|
474
475
|
if transport == 'websocket':
|
|
475
476
|
ret = await s.handle_get_request(environ)
|
|
476
477
|
if s.closed and sid in self.sockets:
|
engineio/async_socket.py
CHANGED
|
@@ -128,10 +128,12 @@ class AsyncSocket(base_socket.BaseSocket):
|
|
|
128
128
|
await self.queue.join()
|
|
129
129
|
|
|
130
130
|
def schedule_ping(self):
|
|
131
|
-
|
|
131
|
+
# only schedule a new ping if the previous ping wait cycle completed
|
|
132
|
+
if self.last_ping:
|
|
133
|
+
self.last_ping = None
|
|
134
|
+
self.server.start_background_task(self._send_ping)
|
|
132
135
|
|
|
133
136
|
async def _send_ping(self):
|
|
134
|
-
self.last_ping = None
|
|
135
137
|
await asyncio.sleep(self.server.ping_interval)
|
|
136
138
|
if not self.closing and not self.closed:
|
|
137
139
|
self.last_ping = time.time()
|
engineio/base_socket.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
class BaseSocket:
|
|
2
5
|
upgrade_protocols = ['websocket']
|
|
3
6
|
|
|
@@ -5,7 +8,7 @@ class BaseSocket:
|
|
|
5
8
|
self.server = server
|
|
6
9
|
self.sid = sid
|
|
7
10
|
self.queue = self.server.create_queue()
|
|
8
|
-
self.last_ping =
|
|
11
|
+
self.last_ping = time.time()
|
|
9
12
|
self.connected = False
|
|
10
13
|
self.upgrading = False
|
|
11
14
|
self.upgraded = False
|
engineio/server.py
CHANGED
|
@@ -401,7 +401,6 @@ class Server(base_server.BaseServer):
|
|
|
401
401
|
'maxPayload': self.max_http_buffer_size,
|
|
402
402
|
})
|
|
403
403
|
s.send(pkt)
|
|
404
|
-
s.schedule_ping()
|
|
405
404
|
|
|
406
405
|
# NOTE: some sections below are marked as "no cover" to workaround
|
|
407
406
|
# what seems to be a bug in the coverage package. All the lines below
|
|
@@ -413,6 +412,8 @@ class Server(base_server.BaseServer):
|
|
|
413
412
|
self.logger.warning('Application rejected connection')
|
|
414
413
|
return self._unauthorized(ret or None)
|
|
415
414
|
|
|
415
|
+
s.schedule_ping()
|
|
416
|
+
|
|
416
417
|
if transport == 'websocket': # pragma: no cover
|
|
417
418
|
ret = s.handle_get_request(environ, start_response)
|
|
418
419
|
if s.closed and sid in self.sockets:
|
engineio/socket.py
CHANGED
|
@@ -130,10 +130,12 @@ class Socket(base_socket.BaseSocket):
|
|
|
130
130
|
self.queue.join()
|
|
131
131
|
|
|
132
132
|
def schedule_ping(self):
|
|
133
|
-
|
|
133
|
+
# only schedule a new ping if the previous ping wait cycle completed
|
|
134
|
+
if self.last_ping:
|
|
135
|
+
self.last_ping = None
|
|
136
|
+
self.server.start_background_task(self._send_ping)
|
|
134
137
|
|
|
135
138
|
def _send_ping(self):
|
|
136
|
-
self.last_ping = None
|
|
137
139
|
self.server.sleep(self.server.ping_interval)
|
|
138
140
|
if not self.closing and not self.closed:
|
|
139
141
|
self.last_ping = time.time()
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
engineio/__init__.py,sha256=0R2PY1EXu3sicP7mkA0_QxEVGRlFlgvsxfhByqREE1A,481
|
|
2
2
|
engineio/async_client.py,sha256=EQzirWwJ_gUinklogHvHN1vz5Ux0zUt-RhGkCureJbE,29976
|
|
3
|
-
engineio/async_server.py,sha256=
|
|
4
|
-
engineio/async_socket.py,sha256=
|
|
3
|
+
engineio/async_server.py,sha256=7oQClUwwSiPlFFUSEBeE6VuOYnbK2z8FCmRqeWoiiVE,27558
|
|
4
|
+
engineio/async_socket.py,sha256=2agIDyicauuHuDHf_2WtUWreq1BP5iu5FQu9tSHWdtY,10827
|
|
5
5
|
engineio/base_client.py,sha256=oOdq-zR7kg8QpvAGti0zBIiFBQGyEELwVMZNtcoJ2ig,5827
|
|
6
6
|
engineio/base_server.py,sha256=tTCqc65Vzf-0Be1uunt1FuGxPOvcpOUCxnT5V2mZCWo,14763
|
|
7
|
-
engineio/base_socket.py,sha256=
|
|
7
|
+
engineio/base_socket.py,sha256=PWiJC1msNo-0ctlP3JAwWsngKvnYM-ZjS6B6zzfu-eM,420
|
|
8
8
|
engineio/client.py,sha256=-9f8kLYOw86QXrFx5PoyI56uHZ1cUKbhVYolTEj-2t8,27784
|
|
9
9
|
engineio/exceptions.py,sha256=FyuMb5qhX9CUYP3fEoe1m-faU96ApdQTSbblaaoo8LA,292
|
|
10
10
|
engineio/json.py,sha256=SG5FTojqd1ix6u0dKXJsZVqqdYioZLO4S2GPL7BKl3U,405
|
|
11
11
|
engineio/middleware.py,sha256=5NKBXz-ftuFErUB_V9IDvRHaSOsjhtW-NnuJtquB1nc,3750
|
|
12
12
|
engineio/packet.py,sha256=YO3gmeKUoKyIsUq2e1z7Zifr5PGeS3gnaCeqR7wj5hQ,3198
|
|
13
13
|
engineio/payload.py,sha256=GIWu0Vnay4WNZlDxHqVgP34tKTBXX58OArJ-mO5zD3E,1539
|
|
14
|
-
engineio/server.py,sha256=
|
|
15
|
-
engineio/socket.py,sha256=
|
|
14
|
+
engineio/server.py,sha256=P6Pa53MRJVoXL_n5tEONuIQoBtOvsdFR5GylKgu5oUE,23088
|
|
15
|
+
engineio/socket.py,sha256=WUwGT9MByp04KjHiEnDaESosNsxYxp6AG1tB3pei9eQ,10454
|
|
16
16
|
engineio/static_files.py,sha256=pwez9LQFaSQXMbtI0vLyD6UDiokQ4rNfmRYgVLKOthc,2064
|
|
17
17
|
engineio/async_drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
engineio/async_drivers/_websocket_wsgi.py,sha256=LuOEfKhbAw8SplB5PMpYKIUqfCPEadQEpqeiq_leOIA,949
|
|
19
|
-
engineio/async_drivers/aiohttp.py,sha256=
|
|
20
|
-
engineio/async_drivers/asgi.py,sha256=
|
|
19
|
+
engineio/async_drivers/aiohttp.py,sha256=SOU9KOoru_OzxLioSKCYNIZQZLoyf-oxw6-bXc6-_L8,3697
|
|
20
|
+
engineio/async_drivers/asgi.py,sha256=9qAPXs4wO4TxTyF-Se-nhilqzufj9on63MWM66D4j0g,11535
|
|
21
21
|
engineio/async_drivers/eventlet.py,sha256=n1y4OjPdj4J2GIep5N56O29oa5NQgFJVcTBjyO1C-Gs,1735
|
|
22
22
|
engineio/async_drivers/gevent.py,sha256=hnJHeWdDQE2jfoLCP5DnwVPzsQlcTLJUMA5EVf1UL-k,2962
|
|
23
23
|
engineio/async_drivers/gevent_uwsgi.py,sha256=m6ay5dov9FDQl0fbeiKeE-Orh5LiF6zLlYQ64Oa3T5g,5954
|
|
24
24
|
engineio/async_drivers/sanic.py,sha256=GYX8YWR1GbRm-GkMTAQkfkWbY12MOT1IV2DzH0Xx8Ns,4495
|
|
25
25
|
engineio/async_drivers/threading.py,sha256=ywmG59d4H6OHZjKarBN97-9BHEsRxFEz9YN-E9QAu_I,463
|
|
26
26
|
engineio/async_drivers/tornado.py,sha256=v9uuGk8_HS6DjhoEKXfjHpki1FnydN4wi7eyBMsUTJA,5908
|
|
27
|
-
python_engineio-4.13.
|
|
28
|
-
python_engineio-4.13.
|
|
29
|
-
python_engineio-4.13.
|
|
30
|
-
python_engineio-4.13.
|
|
31
|
-
python_engineio-4.13.
|
|
27
|
+
python_engineio-4.13.2.dist-info/licenses/LICENSE,sha256=yel9Pbwfu82094CLKCzWRtuIev9PUxP-a76NTDFAWpw,1082
|
|
28
|
+
python_engineio-4.13.2.dist-info/METADATA,sha256=XanaByNEwDBrXOcmqz5fT8CJ2S4qW3voMSpa4Mrchd0,2314
|
|
29
|
+
python_engineio-4.13.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
30
|
+
python_engineio-4.13.2.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
|
|
31
|
+
python_engineio-4.13.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|