You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Degenhardt <bm...@mp3.com> on 2002/06/17 02:34:29 UTC

[PATCH] mod_rewrite: set cookies

We've been using this patch at mp3.com for a while, I figured I'd
forward-port it to apache 2.0 and send it to you folks.  It duplicates
the functionality of the [E=var:val] but sets cookies.  A very basic
example would be to set a cookie called 'lastvisited' containing the
uri of the last page you visited on the site:

RewriteRule (.*) - [CO=lastvisited:$1:.mp3.com]

This could be used in conjuction with the mod_log_config
'%{lastvisited}C' directive for a more robust referrer.

I can supply a patch against 1.3.X if this is deemed a useful feature.

-bmd

Re: [PATCH] mod_rewrite: set cookies

Posted by Ian Holsman <ia...@apache.org>.
Brian Degenhardt wrote:
> --y0ulUmNC+osPPQO6
> Content-Type: text/plain; charset=us-ascii
> 
> We've been using this patch at mp3.com for a while, I figured I'd
> forward-port it to apache 2.0 and send it to you folks.  It duplicates
> the functionality of the [E=var:val] but sets cookies.  A very basic
> example would be to set a cookie called 'lastvisited' containing the
> uri of the last page you visited on the site:
> 
> RewriteRule (.*) - [CO=lastvisited:$1:.mp3.com]
> 
> This could be used in conjuction with the mod_log_config
> '%{lastvisited}C' directive for a more robust referrer.
>

I comitted a slightly different version of this patch.
the main differences:
	1. use r->request_time instead of time(null)
	2. uses a pool instead of a static size array for the cookie
	3. sets the cookie in headers_out not err_headers_out
	as that doesn't really work with internal redirects
	4. modified the XML documentation

Thanks for the patch
Ian