GabrielDeLeon_1
Sep 26, 2014Nimbostratus
IRULE - Search in http query and set two variables
Good afternoon, sorry for my English.
I need to store two variables from a uniq query. For example:
www.example.com/test.jpg?aserver=2&bserver=3
I need a irule looking aserver value and save in variable val_Aserver. And too looking bserver value and save in another value, val_Bserver .
I've been looking and can not find how to do it.
Right now I have the following code:
set val_Aserver [string range [HTTP::uri] [expr {[string first "aserver=" [HTTP::uri]] + 8}] end]
set val_Bserver [string range [HTTP::uri] [expr {[string first "bserver=" [HTTP::uri]] + 8}] end]
This only just save me the first value that I pass from the query,
If I put www.example.com/test.jpg?aserver=2&bserver=3, correctly save val_Aserver is 2, but the val_Bserver is empty.
If I put www.example.com/test.jpg?bserver=5&aserver=4 , correctly save val_Bserver is 5, but the val_Aserver is empty.
I'm going crazy, someone can help me please?
Thank you very much.