[mod_python] Session Cookie Name

Graham Dumpleton grahamd at dscpl.com.au
Wed Oct 5 18:33:25 EDT 2005


On 06/10/2005, at 7:50 AM, Robert Wallner wrote:

>
> On 10/4/05, Terence MacDonald <terry.macdonald at dsl.pipex.com> wrote:
> mod_python 3.1.4
>
> Anyone been able to change the name of the session cookie?   
> According to
> the Session.py module you should be able to do it in the apache config
> file thus;
>
> You could use
>
> from mod_python import Session
> Session.COOKIE_NAME = "newcookiename"

Can't check source code at the moment, but If this is changing
the global cookie name it would be a dangerous thing to do
from within an actual handler.

If a request came in under a different URL in the same interpreter
which used the original cookie name before it got changed that
user session wouldn't work after the change by the different
handler.

Without having 3.2 where the feature for changing cookie names
exists, what you can do is manage the cookie directly yourself
and when you have extracted the SID from your cookie, provide
it to the constructor of Session when you are creating it.

You could still modify Session.COOKIE_NAME, but you would
have to do it from a module imported using the PythonImport
directive, prior to any requests being handled.

Graham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20051006/a30d517d/attachment.html


More information about the Mod_python mailing list