OSDN Git Service

trunk整理
[ultramonkey-l7/ultramonkey-l7-v3.git] / test / script / module-protocol-sessionless / sessionless-11.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.0\r
36 X-Forwarded-For: proxy1, proxy2\r
37 \r\n" | nc 127.0.0.1 40001
38 wait $NC_PID
39
40 echo -e -n "GET / HTTP/1.0\r
41 X-Forwarded-For: proxy1, proxy2, 127.0.0.1\r
42 \r\n" > $TMP_DIR/nc_expect_tmp
43
44 if [ -n "`diff $TMP_DIR/nc_tmp $TMP_DIR/nc_expect_tmp`" ]
45 then
46         echo "Test failed: diff $TMP_DIR/nc_tmp $TMP_DIR/nc_expect_tmp"
47         exit 1
48 fi
49
50 exit 0
51