8-57
Cisco Content Services Switch Administration Guide
OL-5647-02
Chapter 8 Using the CSS Scripting Language
Script Keepalive Examples
Setcookie Keepalive
!no echo
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Filename: ap-kal-setcookie
! Parameters: HostName WebPage cookieString
!
! Description:
! This script will keepalive a WWW server that is setting
! cookies in the HTTP response header. The header value
! looks like this:
! Set-Cookie: NAME=VALUE
!
! The user will be responsible for sending us the name & value
! in a string like “mycookie=myvalue” so that we can compare
! the incoming Set-Cookie: request.
!
! Failure Upon:
! 1. Not establishing a connection with the host.
! 2. Not being able to receive the cookie
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
if ${ARGS}[#] “NEQ” “3”
echo “Usage: ap-kal-setcookie \'Hostname WebPage cookieString\'”
echo “(Where cookieString is a name=value pair like
\'mycookie=myvalue\')”
exit script 1
endbranch
! Defines:
set HostName “${ARGS}[1]”
set WebPage “${ARGS}[2]”
set CookieData “${ARGS}[3]”
! Connect to the remote host (use default timeout)
set EXIT_MSG “Connection Failed”
socket connect host ${HostName} port 80 tcp
! send our request to the host
set EXIT_MSG “Send: Failure”
socket send ${SOCKET} “GET ${WebPage} HTTP/1.0\n\n”
! Wait for the cookie to come in
set EXIT_MSG “Waitfor: Failure”
socket waitfor ${SOCKET} “${CookieData}”