wslink 2.0.2__tar.gz → 2.0.4__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 (31) hide show
  1. {wslink-2.0.2 → wslink-2.0.4}/PKG-INFO +1 -1
  2. {wslink-2.0.2 → wslink-2.0.4}/setup.cfg +1 -1
  3. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/__init__.py +1 -0
  4. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/backends/aiohttp/__init__.py +13 -1
  5. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/chunking.py +2 -1
  6. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/server.py +1 -0
  7. {wslink-2.0.2 → wslink-2.0.4}/src/wslink.egg-info/PKG-INFO +1 -1
  8. {wslink-2.0.2 → wslink-2.0.4}/MANIFEST.in +0 -0
  9. {wslink-2.0.2 → wslink-2.0.4}/README.rst +0 -0
  10. {wslink-2.0.2 → wslink-2.0.4}/setup.py +0 -0
  11. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/LICENSE +0 -0
  12. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/backends/__init__.py +0 -0
  13. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/backends/aiohttp/launcher.py +0 -0
  14. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/backends/aiohttp/relay.py +0 -0
  15. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/backends/generic/__init__.py +0 -0
  16. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/backends/generic/core.py +0 -0
  17. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/backends/jupyter/__init__.py +0 -0
  18. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/backends/jupyter/core.py +0 -0
  19. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/backends/tornado/__init__.py +0 -0
  20. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/backends/tornado/core.py +0 -0
  21. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/launcher.py +0 -0
  22. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/protocol.py +0 -0
  23. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/publish.py +0 -0
  24. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/relay.py +0 -0
  25. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/ssl_context.py +0 -0
  26. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/uri.py +0 -0
  27. {wslink-2.0.2 → wslink-2.0.4}/src/wslink/websocket.py +0 -0
  28. {wslink-2.0.2 → wslink-2.0.4}/src/wslink.egg-info/SOURCES.txt +0 -0
  29. {wslink-2.0.2 → wslink-2.0.4}/src/wslink.egg-info/dependency_links.txt +0 -0
  30. {wslink-2.0.2 → wslink-2.0.4}/src/wslink.egg-info/requires.txt +0 -0
  31. {wslink-2.0.2 → wslink-2.0.4}/src/wslink.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wslink
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: Python/JavaScript library for communicating over WebSocket
5
5
  Home-page: https://github.com/kitware/wslink
6
6
  Author: Kitware, Inc.
@@ -1,5 +1,5 @@
1
1
  [metadata]
2
- version = 2.0.2
2
+ version = 2.0.4
3
3
 
4
4
  [egg_info]
5
5
  tag_build =
@@ -5,6 +5,7 @@ javascript client over a websocket.
5
5
  wslink.server creates the python server
6
6
  wslink.websocket handles the communication
7
7
  """
8
+
8
9
  import asyncio
9
10
  import functools
10
11
 
@@ -35,12 +35,24 @@ def _fix_path(path):
35
35
 
36
36
 
37
37
  # -----------------------------------------------------------------------------
38
+ # Needed for WASM/sharedArrayBuffer
39
+ # => we should find a way to dynamically provided needed header
40
+ # -----------------------------------------------------------------------------
41
+ @aiohttp_web.middleware
42
+ async def shared_array_buffer_headers(request: aiohttp_web.Request, handler):
43
+ response: aiohttp_web.Response = await handler(request)
44
+ response.headers.setdefault("Cross-Origin-Opener-Policy", "same-origin")
45
+ response.headers.setdefault("Cross-Origin-Embedder-Policy", "require-corp")
46
+ response.headers.setdefault("Access-Control-Allow-Origin", "*")
47
+ response.headers.setdefault("Cache-Control", "no-store")
48
+ return response
38
49
 
39
50
 
51
+ # -----------------------------------------------------------------------------
40
52
  class WebAppServer(AbstractWebApp):
41
53
  def __init__(self, server_config):
42
54
  AbstractWebApp.__init__(self, server_config)
43
- self.set_app(aiohttp_web.Application())
55
+ self.set_app(aiohttp_web.Application(middlewares=[shared_array_buffer_headers]))
44
56
  self._ws_handlers = []
45
57
  self._site = None
46
58
  self._runner = None
@@ -1,3 +1,4 @@
1
+ import os
1
2
  import sys
2
3
  import secrets
3
4
  import msgpack
@@ -87,7 +88,7 @@ class UnChunker:
87
88
 
88
89
  def __init__(self):
89
90
  self.pending_messages = {}
90
- self.max_message_size = 512
91
+ self.max_message_size = int(os.environ.get("WSLINK_AUTH_MSG_SIZE", 512))
91
92
 
92
93
  def set_max_message_size(self, size):
93
94
  self.max_message_size = size
@@ -6,6 +6,7 @@ web-pages are determines by the command line arguments passed in.
6
6
  Use "--help" to list the supported arguments.
7
7
 
8
8
  """
9
+
9
10
  import argparse
10
11
  import asyncio
11
12
  import logging
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wslink
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: Python/JavaScript library for communicating over WebSocket
5
5
  Home-page: https://github.com/kitware/wslink
6
6
  Author: Kitware, Inc.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes