httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Kennedy <jus...@justinkennedy.ca>
Subject Re: modify request_rec->args
Date Fri, 25 Mar 2016 14:22:10 GMT
Hi Sorin,

The plan is for the module to do other things, this is just the first step.
Any suggestions? Thank you.

On 25 March 2016 at 05:30, Sorin Manolache <sorinm@gmail.com> wrote:

> 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
>
> --
> Sorin
>
>


-- 
Justin Kennedy
Software Developer
506 645 1195
888 406 0624

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message