Blame tests/regression/config/10-debug-directives.t

Packit 284210
### SecDebug* directive tests
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLog (pos)",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 9
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		debug => [ qr/./, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^200$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLog (neg)",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		-debug => [ qr/./, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^200$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLogLevel 0",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 0
Packit 284210
		SecRule REQUEST_URI "." "phase:1,deny,id:500241"
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		-debug => [ qr/./, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^403$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		GET => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLogLevel 1",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 1
Packit 284210
		SecRuleScript "test.lua" "phase:1"
Packit 284210
		SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500242"
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		debug => [ qr/\]\[[1]\] /, 1 ],
Packit 284210
		-debug => [ qr/\]\[[2-9]\] /, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^403$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
		[
Packit 284210
			"Content-Type" => "application/x-www-form-urlencoded",
Packit 284210
		],
Packit 284210
		"a=1&b=2",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLogLevel 2",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine DetectionOnly
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 2
Packit 284210
		SecRuleScript "test.lua" "phase:1"
Packit 284210
		SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500243"
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		debug => [ qr/\]\[2\] /, 1 ],
Packit 284210
		-debug => [ qr/\]\[[3-9]\] /, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^200$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
		[
Packit 284210
			"Content-Type" => "application/x-www-form-urlencoded",
Packit 284210
		],
Packit 284210
		"a=1&b=2",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLogLevel 3",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 3
Packit 284210
		SecRuleScript "test.lua" "phase:1"
Packit 284210
		SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500244"
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		debug => [ qr/\]\[3\] /, 1 ],
Packit 284210
		-debug => [ qr/\]\[[4-9]\] /, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^403$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
		[
Packit 284210
			"Content-Type" => "application/x-www-form-urlencoded",
Packit 284210
		],
Packit 284210
		"a=1&b=2",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLogLevel 4",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 4
Packit 284210
		SecRuleScript "test.lua" "phase:1"
Packit 284210
		SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500245"
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		debug => [ qr/\]\[4\] /, 1 ],
Packit 284210
		-debug => [ qr/\]\[[5-9]\] /, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^403$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
		[
Packit 284210
			"Content-Type" => "application/x-www-form-urlencoded",
Packit 284210
		],
Packit 284210
		"a=1&b=2",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLogLevel 5",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 5
Packit 284210
		SecRuleScript "test.lua" "phase:1"
Packit 284210
		SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500246"
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		debug => [ qr/\]\[5\] /, 1 ],
Packit 284210
		-debug => [ qr/\]\[[6-9]\] /, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^403$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
		[
Packit 284210
			"Content-Type" => "application/x-www-form-urlencoded",
Packit 284210
		],
Packit 284210
		"a=1&b=2",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLogLevel 6",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 6
Packit 284210
		SecRuleScript "test.lua" "phase:1"
Packit 284210
		SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500247"
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		debug => [ qr/\]\[6\] /, 1 ],
Packit 284210
		-debug => [ qr/\]\[[7-9]\] /, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^403$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
		[
Packit 284210
			"Content-Type" => "application/x-www-form-urlencoded",
Packit 284210
		],
Packit 284210
		"a=1&b=2",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLogLevel 7",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 7
Packit 284210
		SecRuleScript "test.lua" "phase:1"
Packit 284210
		SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500248"
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		debug => [ qr/\]\[7\] /, 1 ],
Packit 284210
		-debug => [ qr/\]\[[8-9]\] /, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^403$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
		[
Packit 284210
			"Content-Type" => "application/x-www-form-urlencoded",
Packit 284210
		],
Packit 284210
		"a=1&b=2",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLogLevel 8",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 8
Packit 284210
		SecRuleScript "test.lua" "phase:1"
Packit 284210
		SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500249"
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		debug => [ qr/\]\[8\] /, 1 ],
Packit 284210
		-debug => [ qr/\]\[9\] /, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^403$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
		[
Packit 284210
			"Content-Type" => "application/x-www-form-urlencoded",
Packit 284210
		],
Packit 284210
		"a=1&b=2",
Packit 284210
	),
Packit 284210
},
Packit 284210
{
Packit 284210
	type => "config",
Packit 284210
	comment => "SecDebugLogLevel 9",
Packit 284210
	conf => qq(
Packit 284210
		SecRuleEngine On
Packit 284210
		SecDebugLog $ENV{DEBUG_LOG}
Packit 284210
		SecDebugLogLevel 9
Packit 284210
		SecRuleScript "test.lua" "phase:1"
Packit 284210
		SecRule REQUEST_URI "(.)" "phase:4,deny,deprecatevar:bogus,id:500250"
Packit 284210
	),
Packit 284210
	match_log => {
Packit 284210
		debug => [ qr/\]\[9\] /, 1 ],
Packit 284210
	},
Packit 284210
	match_response => {
Packit 284210
		status => qr/^403$/,
Packit 284210
	},
Packit 284210
	request => new HTTP::Request(
Packit 284210
		POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
Packit 284210
		[
Packit 284210
			"Content-Type" => "application/x-www-form-urlencoded",
Packit 284210
		],
Packit 284210
		"a=1&b=2",
Packit 284210
	),
Packit 284210
},