Skip to content

Will not expire/delete cookie from session when Set-Cookie only sets Max-Age=0 without Expires #998

Description

@segevfiner
  1. Run the following flask app (Python 3+, Flask 1.1.0):
from flask import Flask


app = Flask(__name__)


@app.route('/set')
def set_():
    return "Set cookie", {'Set-Cookie': 'test=test; Path=/; Max-Age=3600'}


@app.route('/expire')
def expire():
    return "Expired cookie", {'Set-Cookie': 'test=test; Path=/; Max-Age=0'}
  1. http --session=./session.json http://localhost:5000/set - The cookie will be set
  2. http --session=./session.json http://localhost:5000/expire - The cookie will not be unset from the session file, check out its contents.

Flask does auto-set Expires when using set_cookie with only max_age, but not all web frameworks do that, and I don't think it is required by the standard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsessions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions