add cookie support to cas server agent

This is needed to store a session id cookie.
minor regexp cleanups

There is no need to escape non-metacharacters, and the /o flag is
useless when there is no variable in the pattern.
minor style fixup