You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-cvs@httpd.apache.org by co...@apache.org on 2001/11/02 22:03:12 UTC
cvs commit: httpd-test/perl-framework/t/conf extra.conf.in
coar 01/11/02 13:03:12
Modified: perl-framework/t/conf extra.conf.in
Added: perl-framework/t/apache limits.t
Log:
Test the LimitRequest* directives
Revision Changes Path
1.1 httpd-test/perl-framework/t/apache/limits.t
Index: limits.t
===================================================================
#
# Test the LimitRequestLine, LimitRequestFieldSize, LimitRequestFields,
# and LimitRequestBody directives.
#
use strict;
use warnings FATAL => 'all';
use Apache::Test;
use Apache::TestRequest;
#
# These values are chosen to exceed the limits in extra.conf, namely:
#
# LimitRequestLine 128
# LimitRequestFieldSize 1024
# LimitRequestFields 32
# LimitRequestBody 10250000
#
my $fail_requestline = "/" . ('a' x 256);
my $fail_fieldsize = ('a' x 2048);
my %fail_fieldcount;
my $fail_bodysize = 'a' x 10260000;
my $res;
#
# Change to '3' when we get the fieldcount test working.
#
plan tests => 2;
$res = GET_RC($fail_requestline);
print "# Testing too-long request line\n",
"# Expecting status: 414\n",
"# Received status: $res\n";
ok $res == 414;
$res = GET_RC('/', 'X-overflow-field' => $fail_fieldsize);
print "# Testing too-long request header field\n",
"# Expecting status: 400\n",
"# Received status: $res\n";
ok $res == 400;
if (0) {
for (my $i = 1; $i < 65; $i++) {
$fail_fieldcount{'X-Field$i'} = 'Testing field $i';
}
$res = GET_RC('/', \%fail_fieldcount);
print "# Testing too many request header fields\n",
"# Expecting status: 414\n",
"# Received status: $res\n";
ok $res == 414;
}
1.26 +11 -0 httpd-test/perl-framework/t/conf/extra.conf.in
Index: extra.conf.in
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/t/conf/extra.conf.in,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -u -r1.25 -r1.26
--- extra.conf.in 2001/09/16 23:25:49 1.25
+++ extra.conf.in 2001/11/02 21:03:12 1.26
@@ -297,3 +297,14 @@
AllowOverride Indexes
</Directory>
</IfModule>
+
+##
+## apache/limits.t:
+## LimitRequest* directive testing. Note that LimitRequestBody has
+## to be larger than apache/post.t's largest request (currently 10MB),
+## or else that test will fail falsely.
+##
+LimitRequestLine 128
+LimitRequestFieldSize 1024
+LimitRequestFields 32
+LimitRequestBody 10250000
Re: cvs commit: httpd-test/perl-framework/t/conf extra.conf.in
Posted by Stas Bekman <st...@stason.org>.
coar@apache.org wrote:
> coar 01/11/02 13:03:12
>
> Modified: perl-framework/t/conf extra.conf.in
> Added: perl-framework/t/apache limits.t
> Log:
> Test the LimitRequest* directives
> $res = GET_RC($fail_requestline);
> print "# Testing too-long request line\n",
> "# Expecting status: 414\n",
> "# Received status: $res\n";
> ok $res == 414;
Ken, it's much easier to do the same using t_cmp() sub:
use Apache::TestUtil;
ok t_cmp(
414,
GET_RC($fail_requestline),
"Testing too-long request line"
);
it's also more correct, since if $res is left undef for some reason:
undef == 414
will kill the test, whereas t_cmp, will handle it graciously. If course
you can do the extra check manually, but why when there is a special
function designed to handle this.
See 'perldoc Apache::TestUtil' for other useful test utils.
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/