#
# $Id$
#
#
# QS_ClientEventLimitCount 3 10
#
# SetEnvIfPlus Request_Query DecrementLimitCounter=([0-9]+) QS_Limit_Decrement=$1
#
#
# QS_SetEnvIfResBody "Login Failed" QS_Limit
#
INCLUDE scripts/ports
EXEC ./ctl.sh restart -D real_ip >/dev/null
CLIENT
_EXEC echo "[`date '+%a %b %d %H:%M:%S.000000 %Y'`] [test:notice] [pid $$:tid 0] htt: 051_QS_ClientEventLimitCount.htt" >> logs/error_log
_REQ localhost $QS_PORT_BASE
__GET /htt/limit/index.html HTTP/1.1
__Host: localhost
__Req: 01
__
_EXPECT . "
Login Failed"
_WAIT
_CLOSE
_REQ localhost $QS_PORT_BASE
__GET /htt/limit/index.html?DecrementLimitCounter=1 HTTP/1.1
__Host: localhost
__Req: XX
__
_EXPECT . "Login Failed"
_WAIT
_CLOSE
_REQ localhost $QS_PORT_BASE
__GET /htt/limit/index.html HTTP/1.1
__Host: localhost
__Req: 02
__
_EXPECT . "Login Failed"
_WAIT
_CLOSE
_REQ localhost $QS_PORT_BASE
__GET /htt/limit/index.html HTTP/1.1
__Host: localhost
__Req: 03
__
_EXPECT . "Login Failed"
_WAIT
_CLOSE
_REQ localhost $QS_PORT_BASE
__GET /htt/limit/index.html HTTP/1.1
__Host: localhost
__Connection: keep-alive
__Req: 04
__
_EXPECT . "code=067"
_EXPECT . "custom error page"
_WAIT
_CLOSE
_SLEEP 200
_EXPECT EXEC "mod_qos\(067\): access denied, QS_ClientEventLimitCount rule: event=QS_Limit, max=3, current=3"
_EXEC tail -1 logs/error_log
_SLEEP 12000
_REQ localhost $QS_PORT_BASE
__GET /htt/limit/index.html HTTP/1.1
__Host: localhost
__Req: 05
__
_EXPECT . "Login Failed"
_WAIT
_CLOSE
END
SERVER $QS_PORT_BASE6
_LOOP 5
_RES
_WAIT
__HTTP/1.1 200 OK
__Content-Type: text/html
__Content-Length: AUTO
__
__
__Login Failed
__
__
__
_CLOSE
_END LOOP
END
BLOCK FINALLY
_EXEC ./ctl.sh restart 2>/dev/null 1>/dev/null
END