You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/08/13 11:25:16 UTC

svn commit: r1157358 - in /httpd/test/framework/trunk/t: apache/cfg_getline.t conf/extra.conf.in htdocs/apache/cfg_getline/ htdocs/apache/cfg_getline/index.shtml

Author: sf
Date: Sat Aug 13 09:25:15 2011
New Revision: 1157358

URL: http://svn.apache.org/viewvc?rev=1157358&view=rev
Log:
Add test cases for ap_*cfg_getline() with different line lengths

Added:
    httpd/test/framework/trunk/t/apache/cfg_getline.t
    httpd/test/framework/trunk/t/htdocs/apache/cfg_getline/
    httpd/test/framework/trunk/t/htdocs/apache/cfg_getline/index.shtml
Modified:
    httpd/test/framework/trunk/t/conf/extra.conf.in

Added: httpd/test/framework/trunk/t/apache/cfg_getline.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/apache/cfg_getline.t?rev=1157358&view=auto
==============================================================================
--- httpd/test/framework/trunk/t/apache/cfg_getline.t (added)
+++ httpd/test/framework/trunk/t/apache/cfg_getline.t Sat Aug 13 09:25:15 2011
@@ -0,0 +1,49 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestRequest;
+use Apache::TestUtil qw(t_write_file);
+
+use File::Spec;
+
+# test ap_cfg_getline / ap_varbuf_cfg_getline
+
+Apache::TestRequest::user_agent(keep_alive => 1);
+
+my $dir_foo = Apache::Test::vars('serverroot') . '/htdocs/cfg_getline';
+
+my @test_cases = (100, 196 .. 202, 396 .. 402 , 596 .. 602 , 1016 .. 1030,
+                  8170 .. 8195);
+
+if (have_min_apache_version("2.3.15")) {
+    push @test_cases, 8196 .. 8200 , 10000, 100000;
+}
+plan tests => 2 * scalar(@test_cases), need need_lwp,
+                                       need_module('mod_include'),
+                                       need_module('mod_setenvif');
+
+foreach my $len (@test_cases) {
+
+    my $prefix = 'SetEnvIf User-Agent ^ testvar=';
+    my $expect = 'a' x ($len - length($prefix));
+    my $file = File::Spec->catfile(Apache::Test::vars('serverroot'), 'htdocs',
+                                   'apache', 'cfg_getline', '.htaccess');
+    t_write_file($file, "$prefix$expect\n");
+
+    my $response = GET('/apache/cfg_getline/index.shtml');
+    my $rc = $response->code;
+    print "Got rc $rc for length $len\n";
+    ok($rc == 200);
+
+    my $got = $response->content;
+    my $match;
+    if ($got =~ /^'$expect'/) {
+        $match = 1;
+    }
+    else {
+        print "Got      $got\n",
+              "expected '$expect'\n";
+    }
+    ok($match);
+}

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=1157358&r1=1157357&r2=1157358&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/conf/extra.conf.in (original)
+++ httpd/test/framework/trunk/t/conf/extra.conf.in Sat Aug 13 09:25:15 2011
@@ -753,6 +753,13 @@ LimitRequestFields    32
    </IfVersion>
 </IfDefine>
 
+<Directory @SERVERROOT@/htdocs/apache/cfg_getline/>
+    AllowOverride All
+    AddType text/html .shtml
+    AddOutputFilter INCLUDES .shtml
+    Options +Includes
+</Directory>
+
 ##
 ## expression parser test config
 ##

Added: httpd/test/framework/trunk/t/htdocs/apache/cfg_getline/index.shtml
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/htdocs/apache/cfg_getline/index.shtml?rev=1157358&view=auto
==============================================================================
--- httpd/test/framework/trunk/t/htdocs/apache/cfg_getline/index.shtml (added)
+++ httpd/test/framework/trunk/t/htdocs/apache/cfg_getline/index.shtml Sat Aug 13 09:25:15 2011
@@ -0,0 +1 @@
+'<!--#echo var="testvar"-->'