【发布时间】:2016-11-01 13:11:10
【问题描述】:
我正在 localhost 上开发一个cherrypy 应用程序,并写了这个来弄清楚会话发生了什么。
import cherrypy
class WhyNotSessions(object):
@cherrypy.expose
def index(self):
if 'count' not in cherrypy.session:
cherrypy.session['count'] = 0
cherrypy.session['count'] += 1
return "Session count is %s" % cherrypy.session.get('count')
if __name__ == '__main__':
conf = {
'/': {
'tools.sessions.on': True,
'tools.sessions.secure': True
}
}
cherrypy.quickstart(WhyNotSessions(), '/', conf)
这按预期工作,count 在重新加载时递增 - 只要我从 conf 注释掉 'tools.sessions.secure': True。我想更好地了解这里发生了什么,因为我打算在生产中使用安全会话。
【问题讨论】: