You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2018/08/25 13:41:04 UTC
svn commit: r1839054 - in /httpd/test/framework/trunk/t: conf/extra.conf.in
modules/reflector.t
Author: jailletc36
Date: Sat Aug 25 13:41:03 2018
New Revision: 1839054
URL: http://svn.apache.org/viewvc?rev=1839054&view=rev
Log:
Add some tests for the reflector module.
It uses an output filter chain with either nothing or DEFLATE only.
Added:
httpd/test/framework/trunk/t/modules/reflector.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=1839054&r1=1839053&r2=1839054&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/conf/extra.conf.in (original)
+++ httpd/test/framework/trunk/t/conf/extra.conf.in Sat Aug 25 13:41:03 2018
@@ -1232,3 +1232,18 @@ LimitRequestFields 32
SetHandler random_chunk
</Location>
</IfModule>
+
+<IfModule mod_reflector.c>
+ <Location /apache/reflector_nodeflate/>
+ SetHandler reflector
+ # Do not set any filter
+ ReflectorHeader header2reflect
+ ReflectorHeader header2update header2updateUpdated
+ </Location>
+ <Location /apache/reflector_deflate/>
+ SetHandler reflector
+ SetOutputFilter DEFLATE
+ ReflectorHeader header2reflect
+ ReflectorHeader header2update header2updateUpdated
+ </Location>
+</IfModule>
Added: httpd/test/framework/trunk/t/modules/reflector.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/reflector.t?rev=1839054&view=auto
==============================================================================
--- httpd/test/framework/trunk/t/modules/reflector.t (added)
+++ httpd/test/framework/trunk/t/modules/reflector.t Sat Aug 25 13:41:03 2018
@@ -0,0 +1,43 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+use Apache::TestRequest;
+
+my @testcases = (
+ ['/apache/reflector_nodeflate/', "Text that will not reach the DEFLATE filter"],
+ ['/apache/reflector_deflate/', "Text that should be gzipped"],
+);
+
+my @headers;
+push @headers, "header2reflect" => "1";
+push @headers, "header2update" => "1";
+push @headers, "header2delete" => "1";
+push @headers, "Content-Encoding" => "gzip";
+push @headers, "Accept-Encoding" => "gzip";
+
+plan tests => scalar @testcases * 6, need 'reflector', 'mod_deflate';
+
+foreach my $t (@testcases) {
+ my $r = POST($t->[0], @headers, content => $t->[1]);
+
+ # Checking for return code
+ ok t_cmp($r->code, 200, "Checking return code is '200'");
+
+ # Checking for content
+ if (index($t->[0], "_nodeflate") != -1) {
+ # With no filter, we should receive what we have sent
+ ok t_is_equal($r->content, $t->[1]);
+ ok t_cmp($r->header("Content-Encoding"), undef, "'Content-Encoding' has not been added because there was no filter");
+ } else {
+ # With DEFLATE, input should have been updated and 'Content-Encoding' added
+ ok not t_is_equal($r->content, $t->[1]);
+ ok not t_cmp($r->header("Content-Encoding"), undef, "'Content-Encoding' has been added by the DEFLATE filter");
+ }
+
+ # Checking for headers
+ ok t_cmp($r->header("header2reflect"), "1", "'header2reflect' is present");
+ ok t_cmp($r->header("header2updateUpdated"), "1", "'header2updateUpdated' is present");
+ ok t_cmp($r->header("header2delete"), undef, "'header2delete' is absent");
+}