diff options
author | Damien Churchill <damoc@gmail.com> | 2009-12-09 13:13:04 +0000 |
---|---|---|
committer | Damien Churchill <damoc@gmail.com> | 2009-12-09 13:13:04 +0000 |
commit | 0d3f364aaccd459a5d0156f10b6aabfb2dc52330 (patch) | |
tree | 33ffe4e15a550bb3e0cce281d2d8a28dd52b5d75 /deluge/ui/web/auth.py | |
parent | d119fa36291923a82b0df0cd08333a6b056f4bd7 (diff) | |
download | deluge-0d3f364aaccd459a5d0156f10b6aabfb2dc52330.tar.gz deluge-0d3f364aaccd459a5d0156f10b6aabfb2dc52330.tar.bz2 deluge-0d3f364aaccd459a5d0156f10b6aabfb2dc52330.zip |
Apply cookie date fix from adios
Diffstat (limited to 'deluge/ui/web/auth.py')
-rw-r--r-- | deluge/ui/web/auth.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/deluge/ui/web/auth.py b/deluge/ui/web/auth.py index b32e5477d..101bc628a 100644 --- a/deluge/ui/web/auth.py +++ b/deluge/ui/web/auth.py @@ -51,6 +51,8 @@ import time import random import hashlib import logging +from datetime import datetime, timedelta +from email.utils import formatdate from twisted.internet.defer import Deferred from twisted.internet.task import LoopingCall @@ -82,9 +84,9 @@ def get_session_id(session_id): return None def make_expires(timeout): - expires = int(time.time()) + timeout - expires_str = time.strftime('%a, %d %b %Y %H:%M:%S GMT', - time.gmtime(expires)) + dt = timedelta(seconds=timeout) + expires = time.mktime((datetime.now() + dt).timetuple()) + expires_str = formatdate(timeval=expires, localtime=False, usegmt=True) return expires, expires_str class Auth(JSONComponent): |