[mod_python] set cookie in auth stage?

Michael C. Neel neel at mediapulse.com
Thu Feb 5 13:28:21 EST 2004


If your going to pass data between different "application servers", then
best is to stick data into the apache notes table, as that is part of
the apache api so each module should be able to access that data.

In general I don't think you would have to worry about your headers
being replaced, but to be on the safe side there are two things you
could do.  One is to set the cookies in the error headers, which are
always sent (name is misleading, they are sent for errors and normal
requests).  Another option is to also use the fixup handler phase, which
runs after the content handler.  This way the application is done with
the response, and you can add your headers without worring about the
application clearing them.

mike

> -----Original Message-----
> From: Bud P. Bruegger [mailto:bud at comune.grosseto.it] 
> Sent: Thursday, February 05, 2004 1:16 PM
> To: mod_python at modpython.org
> Subject: [mod_python] set cookie in auth stage?
> 
> 
> Hello everyone,
> 
> I'm new to modpython and hope to not ask an overly stupid question.
> 
> Is it possible with modpython (apache) to set a cookie at the 
> authentiction 
> stage while a later stage interfaces to some kind of 
> "application servers" 
> (j2ee, cgi, fcgi, modpython PythonHandler, etc.) that create 
> the actual 
> response?
> 
> The danger I see is that the cookie, being part of the 
> response header, may 
> be overwritten by the application server.  If this is the 
> case, should I 
> prepare the cookie data in the authentication handler and 
> communicate it to 
> a handler that runs after the response is created by the application 
> server.  The manual states that "You can dynamically assign 
> attributes to 
> [the request object] as a way to communicate between 
> handlers".   Is this 
> the mechanism that I could use to communicate the cookie 
> data?  If so, does 
> anyone have an example for such communications?  And also, 
> what stage would 
> I use to actually set the cookie (is the cleanup handler a 
> good choice?).
> 
> Many thanks for any help
> 
> -bud
> 
> 
> 
> --------------------------------------------------------------
> -----------------------------------
> Ing. Bud P. Bruegger, Ph.D.                 bud at comune.grosseto.it
> Servizio Elaborazione Dati                    0564-488 577 (voice)
> Comune di Grosseto                            0564- 21139 (fax)
> Via Ginori, 43
> 58100 Grosseto
> 
> Collaborazione Open Source per la CIE 
> http://www.comune.grosseto.it/cie/ 
> 
> 
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
> 



More information about the Mod_python mailing list