This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Probably defect in Python 3.7.11
Type: crash Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, iritkatriel, ned.deily, vladislavko
Priority: normal Keywords:

Created on 2021-07-07 10:15 by vladislavko, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg397069 - (view) Author: Vladislav Kozlenko (vladislavko) Date: 2021-07-07 10:15
After upgrade to 3.7.11 from 3.7.10 WebSockets start failing.
Django==2.1.2
djangorestframework==3.8.2
daphne==2.3.0
channels==2.3.1

From the 3.7.11 changelog:
Following the controlling specification for URLs defined by WHATWG urllib.parse() now removes ASCII newlines and tabs from URLs, preventing such attacks.

Probably something is not good here now.


2021-07-07T10:11:23.439030174Z2021-07-07 10:11:23,438 ERROR [Failure instance: Traceback: <class 'AttributeError'>: 'NoneType' object has no attribute 'replace'
Error
2021-07-07T10:11:23.439074685Z/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/autobahn/websocket/protocol.py:2841:processHandshake
Error
2021-07-07T10:11:23.439091149Z/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/txaio/tx.py:366:as_future
Error
2021-07-07T10:11:23.439097914Z/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/twisted/internet/defer.py:167:maybeDeferred
Error
2021-07-07T10:11:23.439118640Z/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/daphne/ws_protocol.py:82:onConnect
Error
2021-07-07T10:11:23.439122445Z--- <exception caught here> ---
Error
2021-07-07T10:11:23.439125845Z/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/twisted/internet/defer.py:167:maybeDeferred
Error
2021-07-07T10:11:23.439129088Z/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/daphne/server.py:200:create_application
Error
2021-07-07T10:11:23.439132308Z/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/channels/routing.py:58:__call__
Error
2021-07-07T10:11:23.439135496Z/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/channels/security/websocket.py:35:__call__
Error
2021-07-07T10:11:23.439138809Z/root/.local/share/virtualenvs/app-4PlAip0Q/lib/python3.7/site-packages/channels/security/websocket.py:53:valid_origin
msg397078 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-07-07 13:00
Can you provide a short code example that reproduces this, preferably without using any third party libraries?
msg397094 - (view) Author: Vladislav Kozlenko (vladislavko) Date: 2021-07-07 14:38
It will be not easy as I'll need to create some sandbox for you. The current code version is not available for sharing.


But ok. For example here is a routing.py file:

from django.conf.urls import url
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.security.websocket import AllowedHostsOriginValidator
from channels.auth import AuthMiddlewareStack
from some_dir import MyConsumer

application = ProtocolTypeRouter({
    'websocket': AllowedHostsOriginValidator(
        AuthMiddlewareStack(
            URLRouter([
                url('api/socket/end-point-1', MyConsumer),
            ])
        )
    )
})

Let me know if you need more information
msg397207 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-07-09 18:47
That excerpt is not executable by itself.  Without a reproducible test case and better traceback info, there is not enough information here to investigate further.
msg410560 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-14 14:21
Python 3,7 is no longer maintained. Please create a new issue if you see this on a current version (>= 3.9) and are able to provide more information.
History
Date User Action Args
2022-04-11 14:59:47adminsetgithub: 88743
2022-01-14 14:21:47iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg410560

resolution: rejected
stage: resolved
2021-07-09 18:47:50ned.deilysetnosy: + ned.deily
messages: + msg397207
2021-07-07 14:38:46vladislavkosetmessages: + msg397094
2021-07-07 13:00:39eric.smithsetnosy: + eric.smith
messages: + msg397078
2021-07-07 10:15:20vladislavkocreate