Configuring PI expression using Hex(or Octal) encoded Arguments.
Summary
In PI, there are basically three kinds of arguments for any PI operator, they are:-
1) Numerical Argument
2) String Based Argument
3) Single Character based Argument
For ex:-, take the case of the following PI expression,
HTTP.RES.BODY(10).BEFORE_STR("abcd").SKIP('c',10)
Here, the argument of BODY is a Numerical argument.
the argument of BEFORE_STR is a String Argument.
the first argument of SKIP is a Single Character.
the second argument of SKIP is a Numerical argument.
The String Based arguments are ASCII characters, and so are Character Based Arguments. Now, suppose you want to provide a string Based argument(or Character based), but the character is hard to type from the keyboard (like \r, \n, \t or any other special character), although you are aware of the ASCII value of it. PI provides the user to configure expressions, using the ASCII Values of the characters. You can provide a character(or group of characters) as an argument to the PI-Operators in their HEX or OCTAL Equivalents.
The Format is much similar to the popular C Language Syntax :-
==============================================
\dd -----> For Octal numbers (ex. \77) and 0<d<7; for base 8
\xdd -----> For Hex Numbers (ex. \x3f) and 0<d<15; for base 16
==============================================
Hence the following Rewrite action,
add rewrite action Extract-Header-SERVER insert_http_header Name 'HTTP.RES.HEADER("Server")'
Can be written as,
add rewrite action Extract-Header-SERVER insert_http_header Name 'HTTP.RES.HEADER("\x53erver")'
The format with Numerical operators is fairly straight (and is again similar to the popular C Language Syntax),
====================================================
0xdd -------> For Hex Numbers (ex. 0x3f) and 0<d<15; as base is 16
====================================================
i.e. 0xfff is 4095 in decimal Number system.
Hence the following rewrite action,
add rewrite action act1 insert_http_header Name '1 + 17'
Can be written as,
add rewrite action act1 insert_http_header Name '1 + 0x11'
Add Comment