Ticket #2523: secure-cookies.diff
File secure-cookies.diff, 1.1 KB (added by , 18 years ago) |
---|
-
django/contrib/sessions/middleware.py
a b class SessionMiddleware(object): 79 79 else: 80 80 if modified or settings.SESSION_SAVE_EVERY_REQUEST: 81 81 session_key = request.session.session_key or Session.objects.get_new_session_key() 82 cookie_secure = settings.SESSION_COOKIE_SECURE or None 82 83 if settings.SESSION_EXPIRE_AT_BROWSER_CLOSE: 83 84 max_age = None 84 85 expires = None … … class SessionMiddleware(object): 88 89 new_session = Session.objects.save(session_key, request.session._session, 89 90 datetime.datetime.now() + datetime.timedelta(seconds=settings.SESSION_COOKIE_AGE)) 90 91 response.set_cookie(settings.SESSION_COOKIE_NAME, session_key, 91 max_age=max_age, expires=expires, domain=settings.SESSION_COOKIE_DOMAIN) 92 max_age=max_age, expires=expires, domain=settings.SESSION_COOKIE_DOMAIN, 93 secure=cookie_secure) 92 94 return response