httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron <aar...@divinia.com>
Subject Re: general/2615: Set-Cookie not sent with Redirect response
Date Wed, 23 Dec 1998 01:39:36 GMT
On Tue, 22 Dec 1998, Paul Phillips wrote:

> On Tue, 22 Dec 1998, Rasmus Lerdorf wrote:
> 
> > > Specifically, I was unable send a Set-Cookie with a module similar to
> > > mod_usertrack and using say, a RewriteRule with the 'R' flag.
> > 
> > Is it a module order issue?  As in did the redirect happen first and thus
> > your module never got to send its cookie?  Why not just have your module
> > send the redirect?  Something like:
> > 
> >   ap_table_set(r->headers_out, "location","http://www.apache.org");
> >   r->status = REDIRECT;
> 
> This doesn't set the cookie if it was only added to headers_out, because
> according to an email I have lying around from marcs when I encountered
> this issue writing my own module:
> 
>    I think the current semantics are:
> 
>    headers_out        headers sent only with 200..299 and 304 responses
>    err_headers_out    headers sent with all responses
> 
> Thus the cookie is not set on a 301 or 302 response code.  So, for us
> the workaround was to use err_headers_out, a la:
> 
>     ap_table_addn(r->err_headers_out, "Set-Cookie", cookie);
> 
> Not obvious to the uninitiated though.

Ahh, this makes more sense.  Dean suggested the same solution a few months
back, but it didnt make sense to me because I didnt understand the
function err_headers_out served.

It seemed less logical for my module to short circuit the request by
implicitly setting r->status since its primary function was to set
cookies.

Thanks again,
Aa.


Mime
View raw message