httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@gmail.com>
Subject Re: [users@httpd] Filtering incoming request with mod_ext_filter
Date Wed, 23 Oct 2013 19:24:03 GMT
On Wed, Oct 23, 2013 at 3:18 PM, Daniel Stefaniuk <
daniel.stefaniuk@gmail.com> wrote:

> That's a good question. I don't set it at all. Thanks for pointing that
> out Jeff.
>
> Now, I face another problem. I want to modify header parameters of
> incoming request from the Perl script. Is this possible at all?
>

Maybe if your Perl script runs via mod_perl ;)

mod_ext_filter only provides access to the request and response *bodies*.


> I can see headers in the output file but the input file contains just the
> request body but no header.
>
> Configuration:
>
> ExtFilterDefine myFilterIn ftype=20 mode=input \
>     cmd="c:/tools/perl/bin/perl.exe c:/temp/dump.pl c:/temp/dump.in"
> ExtFilterDefine myFilterOut ftype=30 mode=output \
>     cmd="c:/tools/perl/bin/perl.exe c:/temp/dump.pl c:/temp/dump.out"
> <Directory "c:/Apache24/htdocs">
>     SetInputFilter myFilterIn
>     SetOutputFilter myFilterOut
> </Directory>
>
> Request:
>
> curl -X POST -H "Content-Type: application/json" -H "custom: 1234567890"
> -d '{"username":"xyz","password":"xyz"}' http://localhost/api/login
>
> Thanks
>
> Daniel
>
>
> On 23 October 2013 17:28, Jeff Trawick <trawick@gmail.com> wrote:
>
>> On Wed, Oct 23, 2013 at 12:07 PM, Daniel Stefaniuk <
>> daniel.stefaniuk@gmail.com> wrote:
>>
>>> I try to filter incoming HTTP request. Here is configuration of my
>>> filter:
>>>
>>> LoadModule ext_filter_module modules/mod_ext_filter.so
>>> ExtFilterDefine myFilter ftype=30 mode=input \
>>>     cmd="c:/tools/perl/bin/perl.exe c:/temp/dump.pl c:/temp/dump.out"
>>> <Directory "c:/Apache24/htdocs">
>>>     SetOutputFilter myFilter
>>> </Directory>
>>>
>>> and Perl script I'm using:
>>>
>>> use strict;
>>> open(SAVE, ">$ARGV[0]")
>>>     or die "can't open $ARGV[0]: $?";
>>> while (<STDIN>) {
>>>     print SAVE $_;
>>>     print $_;
>>> }
>>> close(SAVE);
>>>
>>> Apache version = httpd-2.4.6-win32-VC11
>>>
>>> This doesn't work at all giving me an error "*AH00082: an unknown
>>> filter was not added: myFilter*". However, when I set 'mode' to
>>> 'output' it work as expected. Any clue on this?
>>>
>>
>> Were you using "SetInputFilter myFilter" when you had "mode=input"?
>>
>>
>>>
>>> Thanks
>>>
>>> Daniel
>>>
>>
>>
>>
>> --
>> Born in Roswell... married an alien...
>> http://emptyhammock.com/
>>
>
>


-- 
Born in Roswell... married an alien...
http://emptyhammock.com/

Mime
View raw message