View | Details | Raw Unified | Return to bug 64785
Collapse All | Expand All

(-)t/conf/extra.conf.in (+9 lines)
Lines 1333-1341 Link Here
1333
    <Directory @SERVERROOT@/htdocs/modules/allowmethods>
1333
    <Directory @SERVERROOT@/htdocs/modules/allowmethods>
1334
        Options +Indexes
1334
        Options +Indexes
1335
    </Directory>
1335
    </Directory>
1336
    <Directory @SERVERROOT@/htdocs/modules/allowmethods/NoPost>
1337
        AllowMethods -POST
1338
    </Directory>
1336
    <Directory @SERVERROOT@/htdocs/modules/allowmethods/Get>
1339
    <Directory @SERVERROOT@/htdocs/modules/allowmethods/Get>
1337
        AllowMethods GET
1340
        AllowMethods GET
1338
    </Directory>
1341
    </Directory>
1342
    <Directory @SERVERROOT@/htdocs/modules/allowmethods/Get/post>
1343
        AllowMethods +POST
1344
    </Directory>
1345
    <Directory @SERVERROOT@/htdocs/modules/allowmethods/Get/none>
1346
        AllowMethods -GET
1347
    </Directory>
1339
    <Directory @SERVERROOT@/htdocs/modules/allowmethods/Head>
1348
    <Directory @SERVERROOT@/htdocs/modules/allowmethods/Head>
1340
        AllowMethods HEAD
1349
        AllowMethods HEAD
1341
    </Directory>
1350
    </Directory>
(-)t/modules/allowmethods.t (-3 / +14 lines)
Lines 9-14 Link Here
9
my $get = "Get";
9
my $get = "Get";
10
my $head = "Head";
10
my $head = "Head";
11
my $post = "Post";
11
my $post = "Post";
12
my $options = "Options";
12
13
13
##
14
##
14
## mod_allowmethods test
15
## mod_allowmethods test
Lines 15-20 Link Here
15
##
16
##
16
my @test_cases = (
17
my @test_cases = (
17
    [ $get, $get, 200 ],
18
    [ $get, $get, 200 ],
19
    [ $get, "NoPost", 200 ],
20
    [ $post, "NoPost", 405 ],
21
    [ $options, "NoPost" , 200 ],
18
    [ $head, $get, 200 ],
22
    [ $head, $get, 200 ],
19
    [ $post, $get, 405 ],
23
    [ $post, $get, 405 ],
20
    [ $get, $head, 200 ],
24
    [ $get, $head, 200 ],
Lines 24-29 Link Here
24
    [ $head, $post, 405 ],
28
    [ $head, $post, 405 ],
25
    [ $post, $post, 200 ],
29
    [ $post, $post, 200 ],
26
    [ $get, $post . '/reset', 200 ],
30
    [ $get, $post . '/reset', 200 ],
31
    [ $post, $get . '/post', 200 ],
32
    [ $get, $get . '/post', 200 ],
33
    [ $options, $get . '/post', 405 ],
34
    [ $get, $get . '/none', 405 ],
27
);
35
);
28
36
29
plan tests => (scalar @test_cases), have_module 'allowmethods';
37
plan tests => (scalar @test_cases), have_module 'allowmethods';
Lines 30-36 Link Here
30
38
31
foreach my $case (@test_cases) {
39
foreach my $case (@test_cases) {
32
    my ($fct, $allowed, $rc) = @{$case};
40
    my ($fct, $allowed, $rc) = @{$case};
33
    
41
34
    if ($fct eq $get) {
42
    if ($fct eq $get) {
35
        $r = GET('/modules/allowmethods/' . $allowed . '/');
43
        $r = GET('/modules/allowmethods/' . $allowed . '/');
36
    }
44
    }
Lines 40-46 Link Here
40
    elsif ($fct eq $post) {
48
    elsif ($fct eq $post) {
41
        $r = POST('/modules/allowmethods/' . $allowed . '/foo.txt');
49
        $r = POST('/modules/allowmethods/' . $allowed . '/foo.txt');
42
    }
50
    }
51
    elsif ($fct eq $options) {
52
        $r = OPTIONS('/modules/allowmethods/' . $allowed . '/');
53
    }
43
54
44
    ok t_cmp($r->code, $rc, $fct . " - When " . $allowed . " is allowed.");
55
    ok t_cmp($r->code, $rc, "$fct request to /$allowed responds $rc");
45
}
56
}
46
    
57

Return to bug 64785