170 Citrix NetScaler Policy Configuration and Reference Guide

The following table describes various typecasting operations.

Typecasting Operations

Operation

Description

 

 

text.TYPECAST_LIST_

Treats the text in an HTTP request or response body as a list

T(separator)

whose elements are delimited by the character in the

 

separator argument.

 

Text mode settings have no effect on the separator. For

 

example, even if you set the text mode to IGNORECASE,

 

and the separator is the letter “p,” an uppercase “P” is not

 

treated as a separator.

 

The following example creates a Rewrite action that

 

constructs a list from an HTTP request body and extracts the

 

fourth item in the list:

 

add rewrite action myreplace_action REPLACE

 

'http.req.body(100)'

 

'http.req.body(100).typecast_list_

 

t('?').get(4)'

 

set rewrite policy myreplace_policy -action

 

myreplace_action

 

This policy returns the string “fourth item” from the

 

following request:

 

GET?first item?second item?third item?fourth

 

item?

 

The following example extracts the fourth item from the last

 

from the list.

 

add rewrite action myreplace_action1 REPLACE

 

'http.req.body(100)'

 

'http.req.body(100).typecast_list_

 

t('?').get_reverse(4)'

 

set rewrite policy myreplace_policy1 -action

 

myreplace_action1

 

This policy returns the string “first item” from the following

 

request:

 

GET?first item?second item?third item?fourth

 

item

 

Note that the GET_REVERSE operations ignores empty

 

elements in a list.

 

 

Page 184
Image 184
Citrix Systems 9.2 manual Typecasting Operations