Skip to content

Commit ad7e9fc

Browse files
committed
chore: add HTTP/2 tests
1 parent 6001b02 commit ad7e9fc

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/verifyimage.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,51 @@ jobs:
101101
run: |
102102
[ $(docker inspect ${{ matrix.target }}-test --format='{{.State.Running}}') = 'true' ]
103103
if grep -q "nginx "<<< "${{ matrix.target }}"; then
104+
echo "### nginx tests ###"
105+
106+
echo "Storing headers for sample attack..."
104107
curl -q -D headers.txt http://localhost:8080/?test=../../etc/passwd
108+
echo "...done"
109+
110+
echo "Check status 403..."
105111
grep -q "HTTP/1.1 403 Forbidden" headers.txt
112+
echo "...yes"
113+
114+
echo "Check 'Access-Control-Allow-Origin' header..."
106115
grep -q "Access-Control-Allow-Origin: *" headers.txt
116+
echo "...yes"
117+
118+
echo "Check 'Access-Control-Max-Age' header..."
107119
grep -q "Access-Control-Max-Age: 3600" headers.txt
120+
echo "...yes"
121+
122+
echo "Check 'Access-Control-Allow-Methods' header..."
108123
grep -q "Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS" headers.txt
124+
echo "...yes"
125+
126+
echo "Check 'Access-Control-Allow-Headers'..."
109127
grep -q "Access-Control-Allow-Headers: *" headers.txt
128+
echo "...yes"
129+
130+
echo "### nginx tests - done ###"
110131
fi
111132
133+
echo "### generic tests ###"
134+
135+
echo "Test HTTP/2 upgrade..."
136+
curl -v --http2 localhost:8000 2>&1 | tee out.txt
137+
grep -iP "101 Switching Protocols|HTTP/2 200" < out.txt | tee out2.txt
138+
wc -l out2.txt | xargs -I % test % -eq 2
139+
rm out*.txt
140+
echo "...yes"
141+
142+
echo "Test HTTP/2 prior knowledge..."
143+
curl -v --http2-prior-knowledge localhost:8000 2>&1 | tee out.txt
144+
grep -i "HTTP/2 200" < out.txt
145+
echo "...yes"
146+
147+
echo "### generic tests - done ###"
148+
112149
- name: Checkout CRS
113150
uses: actions/checkout@v4
114151
with:

0 commit comments

Comments
 (0)