This fails on all systems that have sed in /usr/bin/sed or someplace other than /bin :(
> On Dec 13, 2016, at 8:20 AM, [email protected] wrote: > > Author: jorton > Date: Tue Dec 13 13:20:32 2016 > New Revision: 1774010 > > URL: http://svn.apache.org/viewvc?rev=1774010&view=rev > Log: > Add basic test case for mod_ext_filter & specific test for PR 60375. > > Added: > httpd/test/framework/trunk/t/modules/ext_filter.t > Modified: > httpd/test/framework/trunk/t/conf/extra.conf.in > > Modified: httpd/test/framework/trunk/t/conf/extra.conf.in > URL: > http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/conf/extra.conf.in?rev=1774010&r1=1774009&r2=1774010&view=diff > ============================================================================== > --- httpd/test/framework/trunk/t/conf/extra.conf.in (original) > +++ httpd/test/framework/trunk/t/conf/extra.conf.in Tue Dec 13 13:20:32 2016 > @@ -1049,3 +1049,29 @@ LimitRequestFields 32 > </IfModule> > </IfVersion> > </IfDefine> > + > + > +# > +# t/modules/ext_filter.t test config > +# > +<IfDefine APACHE2> > + <IfModule mod_ext_filter.c> > + ExtFilterDefine foo-to-bar mode=output cmd="/bin/sed s,foo,bar,g" > + ExtFilterDefine ifoo-to-bar mode=input cmd="/bin/sed s,foo,bar,g" > + AliasMatch /apache/extfilter/[^/]+/(.*) @DocumentRoot@/$1 > + > + <Location /apache/extfilter/out-foo> > + SetOutputFilter foo-to-bar > + </Location> > + > + <Location /apache/extfilter/in-foo> > + SetInputFilter ifoo-to-bar > + </Location> > + > + <Location /apache/extfilter/out-limit> > + SetOutputFilter foo-to-bar > + LimitRequestBody 6 > + </Location> > + > +</IfModule> > +</IfDefine> > > Added: httpd/test/framework/trunk/t/modules/ext_filter.t > URL: > http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/ext_filter.t?rev=1774010&view=auto > ============================================================================== > --- httpd/test/framework/trunk/t/modules/ext_filter.t (added) > +++ httpd/test/framework/trunk/t/modules/ext_filter.t Tue Dec 13 13:20:32 2016 > @@ -0,0 +1,32 @@ > +use strict; > +use warnings FATAL => 'all'; > + > +use Apache::Test; > +use Apache::TestRequest; > +use Apache::TestUtil; > + > +Apache::TestRequest::user_agent(keep_alive => 1); > + > +my $iters = 10; > +my $tests = 3 + $iters * 2; > + > +plan tests => $tests, need need_module('ext_filter'); > + > +if (Apache::TestConfig::WINFU()) { > + skip "Unix-only test" foreach 1..$tests; > +} > + > +ok t_cmp(GET_BODY("/apache/extfilter/out-foo/foobar.html"), "barbar", "sed > output filter"); > + > +my $r = POST "/apache/extfilter/in-foo/modules/cgi/perl_echo.pl", content => > "foobar"; > + > +ok t_cmp($r->code, 200, "echo worked"); > +ok t_cmp($r->content, "barbar", "request body filtered"); > + > +# PR 60375 -- appears to be intermittent failure with 2.4.x ... but works > with trunk? > +foreach (1..$iters) { > + $r = POST "/apache/extfilter/out-limit/modules/cgi/perl_echo.pl", > content => "foo and bar"; > + > + ok t_cmp($r->code, 413, "got 413 error"); > + ok t_cmp($r->content, qr/413 Request Entity Too Large/, "got 413 error > body"); > +} > >
