OSDN Git Service

a9e4669774ffeb04a5b70c44e2051b8fcd14c934
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / module-protocol-sessionless / sessionless-7.sh
1 #!/bin/bash
2
3 . ${SET_DEFAULT_CONF}
4
5 #Run nc server
6 nc -i 1 -l 9876 > ${TMP_DIR}/nc_tmp &
7 NC_PID=$!
8
9 #chkconfig echo-stream on
10
11 #Add Service
12 $L7VSD
13 if [ $? -ne 0 ]
14 then
15         echo "Test failed: $L7VSD"
16         exit 1
17 fi
18
19 usleep 100000
20 $L7VSADM -A -t 127.0.0.1:40001 -m sessionless --forwarded-for
21 if [ $? -ne 0 ]
22 then
23         echo "Test failed: $L7VSADM -A -t 127.0.0.1:40001 -m sessionless --forwarded-for"
24         exit 1
25 fi
26
27 $L7VSADM -a -t 127.0.0.1:40001 -m sessionless -r 127.0.0.1:9876
28 if [ $? -ne 0 ]
29 then
30         echo "Test failed: $L7VSADM -a -t 127.0.0.1:40001 -m sessionless -r 127.0.0.1:9876"
31         exit 1
32 fi
33
34 #Connect
35 echo -e -n "GET / HTTP/1.1\r
36 Host: 127.0.0.1\r
37 \r\n" | nc 127.0.0.1 40001
38 wait $NC_PID
39
40 echo -e -n "GET / HTTP/1.1\r
41 X-Forwarded-For: 127.0.0.1\r
42 Host: 127.0.0.1\r
43 \r\n" > $TMP_DIR/nc_expect_tmp
44
45 if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/nc_expect_tmp`" ]
46 then
47         echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/nc_expect_tmp"
48         exit 1
49 fi
50
51 exit 0
52