File tree 1 file changed +28
-8
lines changed
1 file changed +28
-8
lines changed Original file line number Diff line number Diff line change @@ -50,18 +50,38 @@ jobs:
50
50
sudo /usr/local/nginx/sbin/nginx -c /home/runner/work/ModSecurity-nginx/ModSecurity-nginx/ModSecurity-nginx/.github/nginx/nginx.conf
51
51
- name : Run attack test vhost 1
52
52
run : |
53
- resp=`curl -I -X GET -H "Host: modsectest1" http://localhost/?q=attack | head -1 | cut -d$' ' -f2`
54
- if [ $resp == "403" ]; then echo "OK"; else echo "FAIL"; exit 1; fi
53
+ status=$(curl -sSo /dev/null -w %{http_code} -I -X GET -H "Host: modsectest1" "http://localhost/?q=attack")
54
+ if [ "${status}" == "403" ]; then
55
+ echo "OK"
56
+ else
57
+ echo "FAIL"
58
+ exit 1
59
+ fi
55
60
- name : Run non-attack test vhost 1
56
61
run : |
57
- resp=`curl -I -X GET -H "Host: modsectest1" http://localhost/?q=1 | head -1 | cut -d$' ' -f2`
58
- if [ $resp == "200" ]; then echo "OK"; else echo "FAIL"; exit 1; fi
62
+ status=$(curl -sSo /dev/null -w %{http_code} -I -X GET -H "Host: modsectest1" "http://localhost/?q=1")
63
+ if [ "${status}" == "200" ]; then
64
+ echo "OK"
65
+ else
66
+ echo "FAIL"
67
+ exit 1
68
+ fi
59
69
- name : Run attack test vhost 2
60
70
run : |
61
- resp=`curl -I -X GET -H "Host: modsectest2" http://localhost/?q=attack | head -1 | cut -d$' ' -f2`
62
- if [ $resp == "403" ]; then echo "OK"; else echo "FAIL"; exit 1; fi
71
+ status=$(curl -sSo /dev/null -w %{http_code} -I -X GET -H "Host: modsectest2" "http://localhost/?q=attack")
72
+ if [ "${status}" == "403" ]; then
73
+ echo "OK"
74
+ else
75
+ echo "FAIL"
76
+ exit 1
77
+ fi
63
78
- name : Run non-attack test vhost 2
64
79
run : |
65
- resp=`curl -I -X GET -H "Host: modsectest2" http://localhost/?q=1 | head -1 | cut -d$' ' -f2`
66
- if [ $resp == "200" ]; then echo "OK"; else echo "FAIL"; exit 1; fi
80
+ status=$(curl -sSo /dev/null -w %{http_code} -I -X GET -H "Host: modsectest2" "http://localhost/?q=1")
81
+ if [ "${status}" == "200" ]; then
82
+ echo "OK"
83
+ else
84
+ echo "FAIL"
85
+ exit 1
86
+ fi
67
87
You can’t perform that action at this time.
0 commit comments