django / daphne

Django Channels HTTP/WebSocket server
BSD 3-Clause "New" or "Revised" License
2.32k stars 256 forks source link

Response 400 when submit a 3-Images Form by POST #447

Closed wadefelix closed 1 year ago

wadefelix commented 1 year ago

all run in a python docker instance. OS: Debian 10 Python: 3.9.13 channels 4.0.0 daphne 4.0.0 gunicorn 20.1.0 gevent 22.10.1 Django 4.1.1

I have a View Class serving for a 3-Images Form, only a url, render the form for GET, recieve data for POST. It's all OK when I use the wsgi application(gunicorn). But when I switch all the things to the asgi (daphne), all other http pages are OK but this 3-Images Form page. The newly added websocket also works fine.

When I submit the 3-images Form, get the 400 bad request response. And I cannot find any logging info in the logfile. EVEN daphne-access logfile does not log this request.

wadefelix commented 1 year ago

IT is an issue of twisted. Django allows form field name be Multi-Byte Chactacters, BUT twisted reject it. related code line: https://github.com/twisted/twisted/blob/trunk/src/twisted/web/http.py#L1003 related twisted issue https://github.com/twisted/twisted/issues/4446

carltongibson commented 1 year ago

Thanks for following up! 👍