python-socketio 5.16.1__tar.gz → 5.16.2__tar.gz

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.
Files changed (93) hide show
  1. {python_socketio-5.16.1/src/python_socketio.egg-info → python_socketio-5.16.2}/PKG-INFO +2 -2
  2. {python_socketio-5.16.1 → python_socketio-5.16.2}/pyproject.toml +2 -2
  3. {python_socketio-5.16.1 → python_socketio-5.16.2/src/python_socketio.egg-info}/PKG-INFO +2 -2
  4. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/python_socketio.egg-info/requires.txt +1 -1
  5. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/async_server.py +5 -0
  6. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/server.py +5 -0
  7. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/async/test_server.py +32 -0
  8. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_server.py +29 -0
  9. {python_socketio-5.16.1 → python_socketio-5.16.2}/LICENSE +0 -0
  10. {python_socketio-5.16.1 → python_socketio-5.16.2}/MANIFEST.in +0 -0
  11. {python_socketio-5.16.1 → python_socketio-5.16.2}/README.md +0 -0
  12. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/Makefile +0 -0
  13. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/_static/README.md +0 -0
  14. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/_static/custom.css +0 -0
  15. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/api.rst +0 -0
  16. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/api_client.rst +0 -0
  17. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/api_manager.rst +0 -0
  18. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/api_middleware.rst +0 -0
  19. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/api_namespace.rst +0 -0
  20. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/api_server.rst +0 -0
  21. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/api_simpleclient.rst +0 -0
  22. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/client.rst +0 -0
  23. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/conf.py +0 -0
  24. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/index.rst +0 -0
  25. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/intro.rst +0 -0
  26. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/make.bat +0 -0
  27. {python_socketio-5.16.1 → python_socketio-5.16.2}/docs/server.rst +0 -0
  28. {python_socketio-5.16.1 → python_socketio-5.16.2}/setup.cfg +0 -0
  29. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/python_socketio.egg-info/SOURCES.txt +0 -0
  30. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/python_socketio.egg-info/dependency_links.txt +0 -0
  31. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/python_socketio.egg-info/not-zip-safe +0 -0
  32. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/python_socketio.egg-info/top_level.txt +0 -0
  33. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/__init__.py +0 -0
  34. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/admin.py +0 -0
  35. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/asgi.py +0 -0
  36. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/async_admin.py +0 -0
  37. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/async_aiopika_manager.py +0 -0
  38. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/async_client.py +0 -0
  39. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/async_manager.py +0 -0
  40. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/async_namespace.py +0 -0
  41. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/async_pubsub_manager.py +0 -0
  42. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/async_redis_manager.py +0 -0
  43. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/async_simple_client.py +0 -0
  44. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/base_client.py +0 -0
  45. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/base_manager.py +0 -0
  46. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/base_namespace.py +0 -0
  47. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/base_server.py +0 -0
  48. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/client.py +0 -0
  49. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/exceptions.py +0 -0
  50. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/kafka_manager.py +0 -0
  51. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/kombu_manager.py +0 -0
  52. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/manager.py +0 -0
  53. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/middleware.py +0 -0
  54. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/msgpack_packet.py +0 -0
  55. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/namespace.py +0 -0
  56. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/packet.py +0 -0
  57. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/pubsub_manager.py +0 -0
  58. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/redis_manager.py +0 -0
  59. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/simple_client.py +0 -0
  60. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/tornado.py +0 -0
  61. {python_socketio-5.16.1 → python_socketio-5.16.2}/src/socketio/zmq_manager.py +0 -0
  62. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/__init__.py +0 -0
  63. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/async/__init__.py +0 -0
  64. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/async/test_admin.py +0 -0
  65. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/async/test_client.py +0 -0
  66. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/async/test_manager.py +0 -0
  67. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/async/test_namespace.py +0 -0
  68. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/async/test_pubsub_manager.py +0 -0
  69. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/async/test_redis_manager.py +0 -0
  70. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/async/test_simple_client.py +0 -0
  71. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/asyncio_web_server.py +0 -0
  72. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/__init__.py +0 -0
  73. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_admin.py +0 -0
  74. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_client.py +0 -0
  75. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_manager.py +0 -0
  76. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_middleware.py +0 -0
  77. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_msgpack_packet.py +0 -0
  78. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_namespace.py +0 -0
  79. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_packet.py +0 -0
  80. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_pubsub_manager.py +0 -0
  81. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_redis_manager.py +0 -0
  82. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/common/test_simple_client.py +0 -0
  83. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/performance/README.md +0 -0
  84. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/performance/binary_packet.py +0 -0
  85. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/performance/json_packet.py +0 -0
  86. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/performance/namespace_packet.py +0 -0
  87. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/performance/run.sh +0 -0
  88. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/performance/server_receive.py +0 -0
  89. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/performance/server_send.py +0 -0
  90. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/performance/server_send_broadcast.py +0 -0
  91. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/performance/text_packet.py +0 -0
  92. {python_socketio-5.16.1 → python_socketio-5.16.2}/tests/web_server.py +0 -0
  93. {python_socketio-5.16.1 → python_socketio-5.16.2}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-socketio
3
- Version: 5.16.1
3
+ Version: 5.16.2
4
4
  Summary: Socket.IO server and client for Python
5
5
  Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
6
6
  License: MIT
@@ -14,7 +14,7 @@ Requires-Python: >=3.8
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
  Requires-Dist: bidict>=0.21.0
17
- Requires-Dist: python-engineio>=4.11.0
17
+ Requires-Dist: python-engineio>=4.13.2
18
18
  Provides-Extra: client
19
19
  Requires-Dist: requests>=2.21.0; extra == "client"
20
20
  Requires-Dist: websocket-client>=0.54.0; extra == "client"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "python-socketio"
3
- version = "5.16.1"
3
+ version = "5.16.2"
4
4
  license = {text = "MIT"}
5
5
  authors = [
6
6
  { name = "Miguel Grinberg", email = "miguel.grinberg@gmail.com" },
@@ -15,7 +15,7 @@ classifiers = [
15
15
  requires-python = ">=3.8"
16
16
  dependencies = [
17
17
  "bidict >= 0.21.0",
18
- "python-engineio >= 4.11.0",
18
+ "python-engineio >= 4.13.2",
19
19
  ]
20
20
 
21
21
  [project.readme]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-socketio
3
- Version: 5.16.1
3
+ Version: 5.16.2
4
4
  Summary: Socket.IO server and client for Python
5
5
  Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
6
6
  License: MIT
@@ -14,7 +14,7 @@ Requires-Python: >=3.8
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
  Requires-Dist: bidict>=0.21.0
17
- Requires-Dist: python-engineio>=4.11.0
17
+ Requires-Dist: python-engineio>=4.13.2
18
18
  Provides-Extra: client
19
19
  Requires-Dist: requests>=2.21.0; extra == "client"
20
20
  Requires-Dist: websocket-client>=0.54.0; extra == "client"
@@ -1,5 +1,5 @@
1
1
  bidict>=0.21.0
2
- python-engineio>=4.11.0
2
+ python-engineio>=4.13.2
3
3
 
4
4
  [asyncio_client]
5
5
  aiohttp>=3.4
@@ -427,6 +427,8 @@ class AsyncServer(base_server.BaseServer):
427
427
  if delete_it:
428
428
  self.logger.info('Disconnecting %s [%s]', sid, namespace)
429
429
  eio_sid = self.manager.pre_disconnect(sid, namespace=namespace)
430
+ if eio_sid in self._binary_packet:
431
+ del self._binary_packet[eio_sid]
430
432
  await self._send_packet(eio_sid, self.packet_class(
431
433
  packet.DISCONNECT, namespace=namespace))
432
434
  await self._trigger_event('disconnect', namespace, sid,
@@ -702,6 +704,9 @@ class AsyncServer(base_server.BaseServer):
702
704
  pkt.data)
703
705
  elif pkt.packet_type == packet.BINARY_EVENT or \
704
706
  pkt.packet_type == packet.BINARY_ACK:
707
+ if not self.manager.sid_from_eio_sid(eio_sid,
708
+ pkt.namespace or '/'):
709
+ raise ValueError('Unexpected binary packet')
705
710
  self._binary_packet[eio_sid] = pkt
706
711
  elif pkt.packet_type == packet.CONNECT_ERROR:
707
712
  raise ValueError('Unexpected CONNECT_ERROR packet.')
@@ -402,6 +402,8 @@ class Server(base_server.BaseServer):
402
402
  if delete_it:
403
403
  self.logger.info('Disconnecting %s [%s]', sid, namespace)
404
404
  eio_sid = self.manager.pre_disconnect(sid, namespace=namespace)
405
+ if eio_sid in self._binary_packet:
406
+ del self._binary_packet[eio_sid]
405
407
  self._send_packet(eio_sid, self.packet_class(
406
408
  packet.DISCONNECT, namespace=namespace))
407
409
  self._trigger_event('disconnect', namespace, sid,
@@ -663,6 +665,9 @@ class Server(base_server.BaseServer):
663
665
  self._handle_ack(eio_sid, pkt.namespace, pkt.id, pkt.data)
664
666
  elif pkt.packet_type == packet.BINARY_EVENT or \
665
667
  pkt.packet_type == packet.BINARY_ACK:
668
+ if not self.manager.sid_from_eio_sid(eio_sid,
669
+ pkt.namespace or '/'):
670
+ raise ValueError('Unexpected binary packet')
666
671
  self._binary_packet[eio_sid] = pkt
667
672
  elif pkt.packet_type == packet.CONNECT_ERROR:
668
673
  raise ValueError('Unexpected CONNECT_ERROR packet.')
@@ -719,6 +719,20 @@ class TestAsyncServer:
719
719
  sid, 321, ['my message', 'a', b'foo']
720
720
  )
721
721
 
722
+ async def test_handle_event_binary_from_unknown(self, eio):
723
+ eio.return_value.send = mock.AsyncMock()
724
+ s = async_server.AsyncServer(async_handlers=False)
725
+ await s.manager.connect('123', '/')
726
+ handler = mock.MagicMock()
727
+ s.on('my message', handler)
728
+ with pytest.raises(ValueError):
729
+ await s._handle_eio_message(
730
+ '999',
731
+ '52-["my message","a",'
732
+ '{"_placeholder":true,"num":1},'
733
+ '{"_placeholder":true,"num":0}]',
734
+ )
735
+
722
736
  async def test_handle_event_with_ack(self, eio):
723
737
  eio.return_value.send = mock.AsyncMock()
724
738
  s = async_server.AsyncServer(async_handlers=False)
@@ -923,6 +937,24 @@ class TestAsyncServer:
923
937
  await s.disconnect('1', namespace='/foo')
924
938
  assert calls == s.eio.send.await_count
925
939
 
940
+ async def test_disconnect_with_partial_binary_packet(self, eio):
941
+ eio.return_value.send = mock.AsyncMock()
942
+ eio.return_value.disconnect = mock.AsyncMock()
943
+ s = async_server.AsyncServer()
944
+ await s._handle_eio_connect('123', 'environ')
945
+ await s._handle_eio_message('123', '0')
946
+ await s._handle_eio_message(
947
+ '123',
948
+ '52-["my message","a",'
949
+ '{"_placeholder":true,"num":1},'
950
+ '{"_placeholder":true,"num":0}]',
951
+ )
952
+ await s._handle_eio_message('123', b'foo')
953
+ assert s._binary_packet['123'] is not None
954
+ await s.disconnect('1')
955
+ s.eio.send.assert_any_await('123', '1')
956
+ assert '123' not in s._binary_packet
957
+
926
958
  async def test_namespace_handler(self, eio):
927
959
  eio.return_value.send = mock.AsyncMock()
928
960
  result = {}
@@ -676,6 +676,19 @@ class TestServer:
676
676
  sid, 321, ['my message', 'a', b'foo']
677
677
  )
678
678
 
679
+ def test_handle_event_binary_from_unknown(self, eio):
680
+ s = server.Server(async_handlers=False)
681
+ s.manager.connect('123', '/')
682
+ handler = mock.MagicMock()
683
+ s.on('my message', handler)
684
+ with pytest.raises(ValueError):
685
+ s._handle_eio_message(
686
+ '999',
687
+ '52-["my message","a",'
688
+ '{"_placeholder":true,"num":1},'
689
+ '{"_placeholder":true,"num":0}]',
690
+ )
691
+
679
692
  def test_handle_event_with_ack(self, eio):
680
693
  s = server.Server(async_handlers=False)
681
694
  sid = s.manager.connect('123', '/')
@@ -849,6 +862,22 @@ class TestServer:
849
862
  s.disconnect('123', namespace='/foo')
850
863
  assert calls == s.eio.send.call_count
851
864
 
865
+ def test_disconnect_with_partial_binary_packet(self, eio):
866
+ s = server.Server()
867
+ s._handle_eio_connect('123', 'environ')
868
+ s._handle_eio_message('123', '0')
869
+ s._handle_eio_message(
870
+ '123',
871
+ '52-["my message","a",'
872
+ '{"_placeholder":true,"num":1},'
873
+ '{"_placeholder":true,"num":0}]',
874
+ )
875
+ s._handle_eio_message('123', b'foo')
876
+ assert s._binary_packet['123'] is not None
877
+ s.disconnect('1')
878
+ s.eio.send.assert_any_call('123', '1')
879
+ assert '123' not in s._binary_packet
880
+
852
881
  def test_namespace_handler(self, eio):
853
882
  result = {}
854
883