1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
#!/bin/bash
. testsuite/functions.sh
PORT=12348
run_weborf -b site1 -p $PORT
# ETag header is there
curl -sv http://127.0.0.1:$PORT/robots.txt |& grep Content-Length
CONTENT_LENGTH=$(curl -sv http://127.0.0.1:$PORT/robots.txt |& grep Content-Length | cut -d\ -f3 | tr -d '\r')
ROBOTS="$(
curl -s -r0-5 http://127.0.0.1:$PORT/robots.txt;
curl -s -r6-10 http://127.0.0.1:$PORT/robots.txt;
curl -s -r11- http://127.0.0.1:$PORT/robots.txt)"
curl -s -r0-$(($CONTENT_LENGTH - 1)) http://127.0.0.1:$PORT/robots.txt
if curl -s --fail -r0-$CONTENT_LENGTH http://127.0.0.1:$PORT/robots.txt; then
exit 1
fi
[[ $(curl -s -r0-0 http://127.0.0.1:$PORT/robots.txt | wc -c) = 1 ]]
[[ "$ROBOTS" = $(cat site1/robots.txt) ]]
|