Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 963

Show
Ignore:
Timestamp:
02/08/06 02:08:55
Author:
rdelon
Message:

Use "expires" instead of "max-age" for storing session cookie, due to IE bug :(

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/filters/sessionfilter.py

    r960 r963  
    135135        cookie[cookie_name] = sess.session_id 
    136136        cookie[cookie_name]['path'] = cookie_path 
    137         cookie[cookie_name]['max-age'] = sess.session_timeout * 60 
    138         cookie[cookie_name]['version'] = 1 
     137        # We'd like to use the "max-age" param as 
     138        #   http://www.faqs.org/rfcs/rfc2109.html indicates but IE doesn't 
     139        #   save it to disk and the session is lost if people close 
     140        #   the browser 
     141        #   So we have to use the old "expires" ... sigh ... 
     142        #cookie[cookie_name]['max-age'] = sess.session_timeout * 60 
     143        gmt_expiration_time = time.gmtime(time.time() + 
     144                (sess.session_timeout * 60)) 
     145        cookie[cookie_name]['expires'] = time.strftime( 
     146                "%a, %d-%b-%Y %H:%M:%S GMT", gmt_expiration_time) 
    139147        if cookie_domain is not None: 
    140148            cookie[cookie_name]['domain'] = cookie_domain 

Hosted by WebFaction

Log in as guest/cpguest to create tickets