diff options
| author | Kevin Michel <kevin.michel@sereema.com> | 2020-08-24 22:25:33 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-08-28 12:33:15 +0200 |
| commit | 825ce75faec63ce81601e31152c757a9c28fed13 (patch) | |
| tree | 93c89ad774d62f236371ac01a77f85b499782e98 /django/middleware/security.py | |
| parent | ea57a2834fe32d895e6e6b0f3791feb2fec71737 (diff) | |
Fixed #31928 -- Fixed detecting an async get_response in various middlewares.
SecurityMiddleware and the three cache middlewares were not calling
super().__init__() during their initialization or calling the required
MiddlewareMixin._async_check() method.
This made the middlewares not properly present as coroutine and
confused the middleware chain when used in a fully async context.
Thanks Kordian Kowalski for the report.
Diffstat (limited to 'django/middleware/security.py')
| -rw-r--r-- | django/middleware/security.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/django/middleware/security.py b/django/middleware/security.py index 035c329efb..44921cd22b 100644 --- a/django/middleware/security.py +++ b/django/middleware/security.py @@ -9,7 +9,7 @@ class SecurityMiddleware(MiddlewareMixin): # RemovedInDjango40Warning: when the deprecation ends, replace with: # def __init__(self, get_response): def __init__(self, get_response=None): - self._get_response_none_deprecation(get_response) + super().__init__(get_response) self.sts_seconds = settings.SECURE_HSTS_SECONDS self.sts_include_subdomains = settings.SECURE_HSTS_INCLUDE_SUBDOMAINS self.sts_preload = settings.SECURE_HSTS_PRELOAD @@ -19,7 +19,6 @@ class SecurityMiddleware(MiddlewareMixin): self.redirect_host = settings.SECURE_SSL_HOST self.redirect_exempt = [re.compile(r) for r in settings.SECURE_REDIRECT_EXEMPT] self.referrer_policy = settings.SECURE_REFERRER_POLICY - self.get_response = get_response def process_request(self, request): path = request.path.lstrip("/") |
