Skip to content
Myr

Merge pull request #4486 from uedvt359/pr-deletecookie

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Preserve HttpOnly flag when deleting session cookie

authored by David Lord · committed by GitHub · parents b655a9d, b707bf4 · Browse files · 2 files+9 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+9 added−2 removed

  • other:+9 added−2 removed

2 files+9 added−2 removed

modified:src/flask/sessions.py+7 added-2 removed
381 unmodified lines
382 domain = self.get_cookie_domain(app)383 path = self.get_cookie_path(app)384 secure = self.get_cookie_secure(app)385 samesite = self.get_cookie_samesite(app)386 httponly = self.get_cookie_httponly(app)387388 # If the session is modified to be empty, remove the cookie.389 # If the session is empty, return without setting the cookie.390 if not session:391 if session.modified:392 response.delete_cookie(392 name, domain=domain, path=path, secure=secure, samesite=samesite393 name,394 domain=domain,395 path=path,396 secure=secure,397 samesite=samesite,398 httponly=httponly,399 )400401 return402
3 unmodified lines
406407 if not self.should_set_cookie(app, session):408 return409404 httponly = self.get_cookie_httponly(app)410 expires = self.get_expiration_time(app, session)411 val = self.get_signing_serializer(app).dumps(dict(session)) # type: ignore412 response.set_cookie(413 name,
8 unmodified lines
modified:CHANGES.rst+2 added
43 unmodified lines
44 :issue:`4188`45- When using lazy loading (the default with the debugger), the Click46 context from the ``flask run`` command remains available in the47 loader thread. :issue:`4460`48- Deleting the session cookie uses the ``httponly`` flag.49 :issue:`4485`505152Version 2.0.353-------------
1199 unmodified lines