pallets-eco / flask-session

Server side session extension for Flask
https://flask-session.readthedocs.io
BSD 3-Clause "New" or "Revised" License
501 stars 239 forks source link

After calling session.clear() the Expiry attribute stops being returned #123

Closed jacopo-j closed 6 months ago

jacopo-j commented 4 years ago

Example code:

from flask import Flask, session
from flask_session import Session

app = Flask(__name__, static_url_path="")
app.config["SESSION_TYPE"] = "filesystem"
app.config["SESSION_PERMANENT"] = True
app.config["PERMANENT_SESSION_LIFETIME"] = 30 * 86400
Session(app)

@app.route("/test_working")
def test_working():
    return "", 200

@app.route("/test_not_working")
def test_not_working():
    session.clear()
    session["x"] = "y"
    return "", 200

app.run()

When requesting /test_working I get the following header, which contains the Expires attribute as expected:

set-cookie: session=a40be61f-164a-47d3-b3dc-77a7fd4c66a4; Expires=Thu, 03-Sep-2020 21:12:53 GMT; HttpOnly; Path=/

However, when requesting /test_not_working the Expires attribute is missing:

set-cookie: session=69bb7ea7-a8d5-4a9c-be64-9295b1545f88; HttpOnly; Path=/
louisrigot commented 3 years ago

I'm observing the same behavior (flask-session 0.3.2)

achaayb commented 2 years ago

same behaviour 21/10/2021

Lxstr commented 6 months ago

Fixed post 0.7.0rc1