Modifying client headers

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.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

user13334066

Search

Archives
« prill 2014
DieHënMarMërEnjPreSht
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today