1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #33754 -- Fixed crash with prematurely closed ASGI request body.

Regression in 441103a04d.
This commit is contained in:
Jonas Lundberg
2022-05-30 22:45:48 +02:00
committed by Mariusz Felisiak
parent 292f372768
commit f1e0fc645b
4 changed files with 26 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ import threading
from django.http import FileResponse, HttpResponse
from django.urls import path
from django.views.decorators.csrf import csrf_exempt
def hello(request):
@@ -23,6 +24,11 @@ def sync_waiter(request):
return hello(request)
@csrf_exempt
def post_echo(request):
return HttpResponse(request.body)
sync_waiter.active_threads = set()
sync_waiter.lock = threading.Lock()
sync_waiter.barrier = threading.Barrier(2)
@@ -35,5 +41,6 @@ urlpatterns = [
path("", hello),
path("file/", lambda x: FileResponse(open(test_filename, "rb"))),
path("meta/", hello_meta),
path("post/", post_echo),
path("wait/", sync_waiter),
]