[mod_python] Servlets, cookies and redirect

Jim Dabell jim-mod-python at jimdabell.com
Thu Aug 26 18:52:37 EDT 2004


> In other words, is there any other way than access req object and set
> cookie through instead of using servlets' add_cookie() method?

According to the servlets documentation, add_cookie() is merely a wrapper for 
Cookie.add_cookie(), which sets the cookie in the normal headers, and upon 
looking at the servlets source, it appears that external_redirect() doesn't 
use the workaround.

You could patch mod_python to fix things so Cookie.add_cookie() sets cookies 
for all types of request.  This may interact badly with (IMHO) buggy software 
that assumes Cookie.add_cookie() is a no-op for "error" pages.

A better idea would be to patch the servlets to make external_redirect() use 
the workaround I mentioned before.  I've attached an (untested) patch if you 
need it.

The best idea, in my opinion, is to fix mod_python to honour the headers 
handlers ask it to send, but that too will be incompatible with some (IMHO) 
buggy software.

-- 
Jim Dabell

-------------- next part --------------
A non-text attachment was scrubbed...
Name: external_redirect-fix.diff
Type: text/x-diff
Size: 608 bytes
Desc: not available
Url : http://modpython.org/pipermail/mod_python/attachments/20040826/febda70a/external_redirect-fix.bin


More information about the Mod_python mailing list