File: range

package info (click to toggle)
weborf 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,152 kB
  • sloc: sh: 5,272; ansic: 3,505; python: 762; makefile: 119; xml: 44
file content (23 lines) | stat: -rwxr-xr-x 731 bytes parent folder | download
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) ]]