[mod_python] cookies/session management

Richard richard at ccpgames.com
Wed Apr 18 17:45:08 EST 2001


> -----Original Message-----
> From: Seung Chan Lim [mailto:slim at maya.com]
> Sent: 18. apríl 2001 17:28
> To: Mod_python at modpython.org
> Subject: Re: [mod_python] cookies/session management
> 
> 
> >     r.headers_out["set-cookie:"] = \
> >         "IRWB_SESSIONID=%s;" \
> >   "Expires: %s;" \
> >         "Cache-control: no-cache;" \
> >         "Max-Age=0" % (sessionID, time.time() - TIME_YEAR)
> >
> 
> without knowing anything about mod_python, have you tried
> setting the expires section to be
> 
> Thu, 01-Jan-70 00:00:01 GMT

Now I have :)  Oops.  Unfortunately no change in behaviour.

> what do you mean by "it works if [you] close the browser and 
> reopen it to
> the given site." ?
> you mean the cookie value lingers around in a given session ?

Yes.
If I set an expiry date in the future, the cookie lingers past browser
open and closes as would be expected.
If I set something (including the expiry thing above) that indicates
that the cookie should be expunged then:
  - If I reload the page, the cookie is still there.
  - If I close and reopen the browser, the cookie is no longer there.

> are you
> checking to
> see if this cookie exist on the server side code or via 
> client-side code
> like javascript or something?

Server side code:
  if r.headers_in.has_key('Cookie'):
    c = r.headers_in['Cookie']

Richard.



More information about the Mod_python mailing list