In the nsapi scripting plugin, earlier, i had added a setheader command
through which a header:value can be inserted into the incoming client headers.
But i found that rather clumsy - why should the script writer come to realize
that rq.headers are somehow special, and that, to insert something into them,
one should call setheaders - while rq.reqpb, rq.srvhdrs, can be modified like
just any other variable.
So i added a bit of code to get around this, and now rq.headers.xxx can be
treated just like the rest.
For example, say you want to configure your proxy server such that it "ignores"
"pragma: no-cache":
# Get rid of "pragma: no-cache"
p = $rq.headers.pragma
if $p == ".*no-cache.*"
then
rq.headers.pragma = ""
fi
I have also enabled "script caching" now. If you don't want caching - say if
you wanna modify a script on the fly - then just add a caching="off"
argument while invoking the nsh SAF. With caching, there is a heavy performance
boost, as the disk read & lexer/parser stages need to happen only once.