session_cookie_name fix due to https://github.com/pallets/flask/pull/4995/files
This commit is contained in:
@@ -92,7 +92,8 @@ class SessionInterface(QuartSessionInterface):
|
|||||||
app: Quart,
|
app: Quart,
|
||||||
request: BaseRequestWebsocket
|
request: BaseRequestWebsocket
|
||||||
) -> Optional[SecureCookieSession]:
|
) -> Optional[SecureCookieSession]:
|
||||||
sid = request.cookies.get(app.session_cookie_name)
|
cname = app.config.get('SESSION_COOKIE_NAME', 'session')
|
||||||
|
sid = request.cookies.get(cname)
|
||||||
if self._config['SESSION_REVERSE_PROXY'] is True:
|
if self._config['SESSION_REVERSE_PROXY'] is True:
|
||||||
# and no, you cannot define your own incoming
|
# and no, you cannot define your own incoming
|
||||||
# header, stick to standards :-)
|
# header, stick to standards :-)
|
||||||
@@ -163,13 +164,14 @@ class SessionInterface(QuartSessionInterface):
|
|||||||
isinstance(response.response, FileBody):
|
isinstance(response.response, FileBody):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
cname = app.config.get('SESSION_COOKIE_NAME', 'session')
|
||||||
session_key = self.key_prefix + session.sid
|
session_key = self.key_prefix + session.sid
|
||||||
domain = self.get_cookie_domain(app)
|
domain = self.get_cookie_domain(app)
|
||||||
path = self.get_cookie_path(app)
|
path = self.get_cookie_path(app)
|
||||||
if not session:
|
if not session:
|
||||||
if session.modified:
|
if session.modified:
|
||||||
await self.delete(key=session_key, app=app)
|
await self.delete(key=session_key, app=app)
|
||||||
response.delete_cookie(app.session_cookie_name,
|
response.delete_cookie(cname,
|
||||||
domain=domain, path=path)
|
domain=domain, path=path)
|
||||||
return
|
return
|
||||||
httponly = self.get_cookie_httponly(app)
|
httponly = self.get_cookie_httponly(app)
|
||||||
@@ -187,7 +189,7 @@ class SessionInterface(QuartSessionInterface):
|
|||||||
session_id = self._get_signer(app).sign(want_bytes(session.sid))
|
session_id = self._get_signer(app).sign(want_bytes(session.sid))
|
||||||
else:
|
else:
|
||||||
session_id = session.sid
|
session_id = session.sid
|
||||||
response.set_cookie(app.session_cookie_name, session_id,
|
response.set_cookie(cname, session_id,
|
||||||
expires=expires, httponly=httponly,
|
expires=expires, httponly=httponly,
|
||||||
domain=domain, path=path, secure=secure, samesite=samesite)
|
domain=domain, path=path, secure=secure, samesite=samesite)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user