You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While running a Quart app i get the following stacktrace on a websocket request:
2024-11-06 17:01:34,181 | ERROR: Exception inside application: 'scheme' (server.py:297)
Traceback (most recent call last):
File "/LOCAL/garcia/Projects/triplaystudio/.venv/lib/python3.11/site-packages/quart/app.py", line 1667, in __call__
await self.asgi_app(scope, receive, send)
File "/LOCAL/garcia/Projects/triplaystudio/.venv/lib/python3.11/site-packages/quart/app.py", line 1693, in asgi_app
await asgi_handler(receive, send)
File "/LOCAL/garcia/Projects/triplaystudio/.venv/lib/python3.11/site-packages/quart/asgi.py", line 166, in __call__
websocket = self._create_websocket_from_scope(send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/LOCAL/garcia/Projects/triplaystudio/.venv/lib/python3.11/site-packages/quart/asgi.py", line 204, in _create_websocket_from_scope
self.scope["scheme"],
~~~~~~~~~~^^^^^^^^^^
KeyError: 'scheme'
10.242.2.5:57258 - - [06/Nov/2024:17:01:34] "WSDISCONNECT /conn" - -
It seems like the 'scheme' property is missing for the websocket connection scope. I am not 100% sure if this issue belongs to daphne, since the asgi documentation marks 'scheme' as an optional setting. However, the documentation also states 'but must not be empty'. If this is indeed related to the Quart project i am really sorry for posting it here. I tested the same code with Hypercorn, so the actual request itself should not be an issue here.
As I understand the spec, Optional (but must not be empty); default is "ws". should be read as if provided must not be empty, but optional, defaulting to ws (if not provided).
It wouldn't hurt to set though if we can get it from the client_scheme. Would it be something you'd be interested to add?
Ok that makes sense. I guess Hypercorn (which was built by a Quart developer) then sets it by default and Quart never checks because of it. Sorry for bothering you then.
Currently i am on vacation. Also I am fairly new to programming and have never added to a repo before, therefore I am not sure if I am the right fit for this. But I can have a look at it once I am back.
Activity
carltongibson commentedon Nov 6, 2024
As I understand the spec,
Optional (but must not be empty); default is "ws".should be read as if provided must not be empty, but optional, defaulting tows(if not provided).It wouldn't hurt to set though if we can get it from the
client_scheme. Would it be something you'd be interested to add?FelixFunk commentedon Nov 8, 2024
Ok that makes sense. I guess Hypercorn (which was built by a Quart developer) then sets it by default and Quart never checks because of it. Sorry for bothering you then.
Currently i am on vacation. Also I am fairly new to programming and have never added to a repo before, therefore I am not sure if I am the right fit for this. But I can have a look at it once I am back.
carltongibson commentedon Nov 8, 2024
@FelixFunk Thanks for the reply. Don't feel obliged. Only take it on if that's something you'd enjoy. Have a good holiday!