bbangert / beaker

WSGI middleware for sessions and caching
https://beaker.readthedocs.org/
Other
517 stars 146 forks source link

modify\change time update on session read #152

Open ph0en opened 6 years ago

ph0en commented 6 years ago

I have filesystem storage. Config:

session_opts = {
    'session.type': 'file',
    'session.cookie_expires': 1800,
    'session.timeout': 1800,
    'session.data_dir': './data',
    'session.auto': True,
    'session.key': 'PHPSESSIONID',
    #    'session.httponly': True,
    #    'session.secure': True
}

every time I read values from session like this

session = bottle.request.environ.get('beaker.session')
if 'authorized' in session and 'login' in session:
    if login == session['login'] and session['authorized'] == 1:

I have modify\change time changed on session file Thus it is impossible to remove old session files using this doc https://beaker.readthedocs.io/en/latest/sessions.html?highlight=modify%20time#removing-expired-old-sessions Have to check _creation_time and delete session manualy if (time() - session_opts['session.timeout']) > session['_creation_time']: session.delete()