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:
parent
299e9e0821
commit
2f89e99cb8
1 changed files with 1 additions and 1 deletions
|
@ -336,7 +336,7 @@ class AjaxProxy(View):
|
||||||
request = Request(url, headers=headers)
|
request = Request(url, headers=headers)
|
||||||
opener = build_opener()
|
opener = build_opener()
|
||||||
try:
|
try:
|
||||||
proxied_request = opener.open(request)
|
proxied_request = opener.open(request, timeout=10)
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
return HttpResponse(e.msg, status=e.code, content_type="text/plain")
|
return HttpResponse(e.msg, status=e.code, content_type="text/plain")
|
||||||
except URLError:
|
except URLError:
|
||||||
|
|
Loading…
Reference in a new issue