-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Will not expire/delete cookie from session when Set-Cookie only sets Max-Age=0 without Expires #998
Comments
@jakubroztocil, Good afternoon! What is in the variable The reason why we don't have the >>> import requests
>>> r = requests.get('http://localhost:5000/expire')
>>> r.cookies
<RequestsCookieJar[]>
>>> r.headers
{'Set-Cookie': 'test=test; Path=/; Max-Age=0', 'Content-Type': 'text/html; charset=utf-8', 'Content-Length': '14', 'Server': 'Werkzeug/1.0.1 Python/3.8.7', 'Date': 'Thu, 04 Feb 2021 12:55:55 GMT'} It seems to me that this is a bug in cookies = [
# The first attr name is the cookie name.
dict(attrs[1:], name=attrs[0][0])
for attrs in attr_sets
]
# issue ...
for cookie in cookies:
max_age = cookie.get('max-age')
if max_age and max_age.isdigit():
cookie['expires'] = now + float(max_age)
return [
{
'name': cookie['name'],
'path': cookie.get('path', '/')
}
for cookie in cookies
if is_expired(expires=cookie.get('expires'))
] |
Add issue for |
http --session=./session.json http://localhost:5000/set
- The cookie will be sethttp --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 usingset_cookie
with onlymax_age
, but not all web frameworks do that, and I don't think it is required by the standard.The text was updated successfully, but these errors were encountered: