tests for PR64785 / r1883203.

Submitted By: Marcel Montes <spiceman gmail.com>




git-svn-id: https://svn.apache.org/repos/asf/httpd/test/framework/trunk@1883204 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/t/conf/extra.conf.in b/t/conf/extra.conf.in
index 564e8fa..4e45dd2 100644
--- a/t/conf/extra.conf.in
+++ b/t/conf/extra.conf.in
@@ -1333,9 +1333,18 @@
     <Directory @SERVERROOT@/htdocs/modules/allowmethods>
         Options +Indexes
     </Directory>
+    <Directory @SERVERROOT@/htdocs/modules/allowmethods/NoPost>
+        AllowMethods -POST
+    </Directory>
     <Directory @SERVERROOT@/htdocs/modules/allowmethods/Get>
         AllowMethods GET
     </Directory>
+    <Directory @SERVERROOT@/htdocs/modules/allowmethods/Get/post>
+        AllowMethods +POST
+    </Directory>
+    <Directory @SERVERROOT@/htdocs/modules/allowmethods/Get/none>
+        AllowMethods -GET
+    </Directory>
     <Directory @SERVERROOT@/htdocs/modules/allowmethods/Head>
         AllowMethods HEAD
     </Directory>
diff --git a/t/htdocs/modules/allowmethods/Get/post/foo.txt b/t/htdocs/modules/allowmethods/Get/post/foo.txt
new file mode 100644
index 0000000..5716ca5
--- /dev/null
+++ b/t/htdocs/modules/allowmethods/Get/post/foo.txt
@@ -0,0 +1 @@
+bar
diff --git a/t/htdocs/modules/allowmethods/NoPost/.empty b/t/htdocs/modules/allowmethods/NoPost/.empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/t/htdocs/modules/allowmethods/NoPost/.empty
diff --git a/t/modules/allowmethods.t b/t/modules/allowmethods.t
index ad34959..d012554 100644
--- a/t/modules/allowmethods.t
+++ b/t/modules/allowmethods.t
@@ -9,6 +9,7 @@
 my $get = "Get";
 my $head = "Head";
 my $post = "Post";
+my $options = "Options";
 
 ##
 ## mod_allowmethods test
@@ -23,14 +24,28 @@
     [ $get, $post, 405 ],
     [ $head, $post, 405 ],
     [ $post, $post, 200 ],
-    [ $get, $post . '/reset', 200 ],
 );
 
+my @new_test_cases = (
+    [ $get, $post . '/reset', 200 ],
+    [ $post, $get . '/post', 200 ],
+    [ $get, $get . '/post', 200 ],
+    [ $options, $get . '/post', 405 ],
+    [ $get, $get . '/none', 405 ],
+    [ $get, "NoPost", 200 ],
+    [ $post, "NoPost", 405 ],
+    [ $options, "NoPost" , 200 ],
+);
+
+if (have_min_apache_version('2.5.1')) { 
+    push(@test_cases, @new_test_cases);
+}
+
 plan tests => (scalar @test_cases), have_module 'allowmethods';
 
 foreach my $case (@test_cases) {
     my ($fct, $allowed, $rc) = @{$case};
-    
+
     if ($fct eq $get) {
         $r = GET('/modules/allowmethods/' . $allowed . '/');
     }
@@ -40,7 +55,10 @@
     elsif ($fct eq $post) {
         $r = POST('/modules/allowmethods/' . $allowed . '/foo.txt');
     }
+    elsif ($fct eq $options) {
+        $r = OPTIONS('/modules/allowmethods/' . $allowed . '/');
+    }
 
-    ok t_cmp($r->code, $rc, $fct . " - When " . $allowed . " is allowed.");
+    ok t_cmp($r->code, $rc, "$fct request to /$allowed responds $rc");
 }
-    
+