|
| 1 | +--- django/contrib/messages/storage/cookie.py.orig 2020-08-13 11:10:36.719177122 +0200 |
| 2 | ++++ django/contrib/messages/storage/cookie.py 2020-08-13 11:45:23.503463150 +0200 |
| 3 | +@@ -92,6 +92,8 @@ |
| 4 | + response.delete_cookie( |
| 5 | + self.cookie_name, |
| 6 | + domain=settings.SESSION_COOKIE_DOMAIN, |
| 7 | ++ secure=settings.SESSION_COOKIE_SECURE or None, |
| 8 | ++ httponly=settings.SESSION_COOKIE_HTTPONLY or None, |
| 9 | + samesite=settings.SESSION_COOKIE_SAMESITE, |
| 10 | + ) |
| 11 | + |
| 12 | +--- django/http/response.py.orig 2020-08-13 11:16:04.060627793 +0200 |
| 13 | ++++ django/http/response.py 2020-08-13 11:54:03.482476973 +0200 |
| 14 | +@@ -210,12 +210,19 @@ |
| 15 | + value = signing.get_cookie_signer(salt=key + salt).sign(value) |
| 16 | + return self.set_cookie(key, value, **kwargs) |
| 17 | + |
| 18 | +- def delete_cookie(self, key, path='/', domain=None, samesite=None): |
| 19 | ++ def delete_cookie(self, key, path='/', domain=None, secure=False, httponly=False, samesite=None): |
| 20 | + # Most browsers ignore the Set-Cookie header if the cookie name starts |
| 21 | + # with __Host- or __Secure- and the cookie doesn't use the secure flag. |
| 22 | +- secure = key.startswith(('__Secure-', '__Host-')) |
| 23 | ++ import debug |
| 24 | ++ if key in self.cookies: |
| 25 | ++ domain = self.cookies[key].get('domain', domain) |
| 26 | ++ secure = self.cookies[key].get('secure', secure) |
| 27 | ++ httponly = self.cookies[key].get('httponly', httponly) |
| 28 | ++ samesite = self.cookies[key].get('samesite', samesite) |
| 29 | ++ else: |
| 30 | ++ secure = secure or key.startswith(('__Secure-', '__Host-')) |
| 31 | + self.set_cookie( |
| 32 | +- key, max_age=0, path=path, domain=domain, secure=secure, |
| 33 | ++ key, max_age=0, path=path, domain=domain, secure=secure, httponly=httponly, |
| 34 | + expires='Thu, 01 Jan 1970 00:00:00 GMT', samesite=samesite, |
| 35 | + ) |
| 36 | + |
| 37 | +--- django/contrib/sessions/middleware.py.orig 2020-08-13 12:12:12.401898114 +0200 |
| 38 | ++++ django/contrib/sessions/middleware.py 2020-08-13 12:14:52.690520659 +0200 |
| 39 | +@@ -39,6 +39,8 @@ |
| 40 | + settings.SESSION_COOKIE_NAME, |
| 41 | + path=settings.SESSION_COOKIE_PATH, |
| 42 | + domain=settings.SESSION_COOKIE_DOMAIN, |
| 43 | ++ secure=settings.SESSION_COOKIE_SECURE or None, |
| 44 | ++ httponly=settings.SESSION_COOKIE_HTTPONLY or None, |
| 45 | + samesite=settings.SESSION_COOKIE_SAMESITE, |
| 46 | + ) |
| 47 | + else: |
0 commit comments