Imported Upstream version 2.5.11
[libapache-mod-security.git] / apache2 / t / regression / action / 10-append-prepend.t
1 # TODO: Need more tests here
2
3 ### append
4 {
5         type => "action",
6         comment => "append content",
7         conf => qq(
8                 SecRuleEngine On
9         SecContentInjection On
10                 SecDebugLog "$ENV{DEBUG_LOG}"
11                 SecDebugLogLevel 9
12                 SecAction "phase:1,setvar:tx.test=test"
13                 SecAction "phase:2,append:'APPEND: \%{tx.test}'"
14         ),
15         match_log => {
16         debug => [ "Added content to bottom: APPEND: test", 1 ],
17         },
18         match_response => {
19                 status => qr/^200$/,
20                 content => qr/APPEND: test$/,
21         },
22         request => new HTTP::Request(
23                 GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
24         ),
25 },
26
27 ### prepend
28 {
29         type => "action",
30         comment => "prepend content",
31         conf => qq(
32                 SecRuleEngine On
33         SecContentInjection On
34                 SecDebugLog "$ENV{DEBUG_LOG}"
35                 SecDebugLogLevel 9
36                 SecAction "phase:1,setvar:tx.test=test"
37                 SecAction "phase:2,prepend:'PREPEND: \%{tx.test}'"
38         ),
39         match_log => {
40         debug => [ "Added content to top: PREPEND: test", 1 ],
41         },
42         match_response => {
43                 status => qr/^200$/,
44                 content => qr/^PREPEND: test/,
45         },
46         request => new HTTP::Request(
47                 GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
48         ),
49 },