]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add pipelined POST requests check in the statschannel system test
authorAram Sargsyan <aram@isc.org>
Wed, 20 Jul 2022 13:33:40 +0000 (13:33 +0000)
committerAram Sargsyan <aram@isc.org>
Fri, 19 Aug 2022 08:11:44 +0000 (08:11 +0000)
Use `nc` to check that multiple POST requests with non-empty HTTP
body are serviced normally by the statistics channel.

bin/tests/system/statschannel/tests.sh

index 5485a5cbbf9cabae0e2756ad1f242ad390c142e0..1d0cff0589a80a9dd407d444087ca1142994555b 100644 (file)
@@ -377,7 +377,7 @@ status=$((status + ret))
 n=$((n + 1))
 
 if [ -x "${NC}" ] ; then
-    echo_i "Check HTTP/1.1 pipelined requests are handled ($n)"
+    echo_i "Check HTTP/1.1 pipelined requests are handled (GET) ($n)"
     ret=0
     ${NC} 10.53.0.3 ${EXTRAPORT1} << EOF > nc.out$n || ret=1
 GET /xml/v3/status HTTP/1.1
@@ -397,6 +397,33 @@ else
     echo_i "skipping test as nc not found"
 fi
 
+if [ -x "${NC}" ] ; then
+    echo_i "Check HTTP/1.1 pipelined requests are handled (POST) ($n)"
+    ret=0
+    ${NC} 10.53.0.3 ${EXTRAPORT1} << EOF > nc.out$n || ret=1
+POST /xml/v3/status HTTP/1.1
+Host: 10.53.0.3:${EXTRAPORT1}
+Content-Type: application/json
+Content-Length: 3
+
+{}
+POST /xml/v3/status HTTP/1.1
+Host: 10.53.0.3:${EXTRAPORT1}
+Content-Type: application/json
+Content-Length: 3
+Connection: close
+
+{}
+EOF
+    lines=$(grep "^HTTP/1.1" nc.out$n | wc -l)
+    test $lines = 2 || ret=1
+    if [ $ret != 0 ]; then echo_i "failed"; fi
+    status=$((status + ret))
+    n=$((n + 1))
+else
+    echo_i "skipping test as nc not found"
+fi
+
 echo_i "Check HTTP/1.1 pipelined with truncated stream ($n)"
 ret=0
 i=0