Add a timeout in proxy

This view should not be used in production, but it is sometimes, so
just in case…
This commit is contained in:
Yohan Boniface 2023-07-21 12:50:37 +02:00
parent 299e9e0821
commit 2f89e99cb8

View file

@ -336,7 +336,7 @@ class AjaxProxy(View):
request = Request(url, headers=headers)
opener = build_opener()
try:
proxied_request = opener.open(request)
proxied_request = opener.open(request, timeout=10)
except HTTPError as e:
return HttpResponse(e.msg, status=e.code, content_type="text/plain")
except URLError: