httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <>
Subject Re: modify request_rec->args
Date Fri, 25 Mar 2016 08:30:35 GMT
On 2016-03-25 00:59, Justin Kennedy wrote:
> Hello,
> I have a simple module, with just a quick_hander, it's sole function is to
> check if there is a specific key=value on the query string, and modify the
> value, so it gets picked up by a separate module.
> For example: if "foo=1" is in r->args, then replace it with "foo=0",
> decline the request so it gets picked up by the other module.
> In my first attempt, I created a new string and assigned the pointer to
> r->args, but it doesn't seem to "stick" when it gets to the second module.
> Do I have to modify r->args directly, without changing the pointer? It's
> been awhile since I've worked with C strings.

You don't need a module to do that. You can use some mod_rewrite 
directives that you place inside your <Location> or <Directory>:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^(|.*&)foo=([^&]*)(&.*|$)
RewriteRule (.*) $1?%1foo=new_value%3


View raw message