Chapter 3 Configuring Advanced Expressions: Getting Started 45

Basic Operations for Expressions

Operation

Determines whether or not

 

 

GT(<integer>)

An object's value is greater than a particular value. Following is

 

an example:

 

http.req.content_length.gt(5)

 

 

The following table summarizes a few of the available types of operations.

Basic Types of Operations

Operation Type

Description

 

 

Text operations

Match individual strings and sets of strings with any portion

 

of a target. The target can be an entire string, the start of a

 

string, or any portion of text in between the start and the end

 

of the string.

 

For example, you can extract the string "XYZ" from

 

"XYZSomeText". Or, you can compare an HTTP header

 

value with an array of different strings.

 

You can also transform text into another type of data.

 

Following are examples:

 

• Transform a string into an integer value

 

• Create a list from the query strings in a URL

 

• Transform a string into a time value

 

 

Numeric operations

Numeric operations include applying arithmetic operators,

 

evaluating content length, the number of items in a list,

 

dates, times, and IP addresses.

 

 

Compound Advanced Expressions

You can configure an advanced expression that contains Boolean or arithmetic operators and multiple atomic operations. The following compound expression contains a boolean AND:

http.req.hostname.eq("mycompany.com") && http.req.method.eq(post)

The following expression adds the value of two targets, and compares the result to a third value:

http.req.url.length + http.req.cookie.length <= 500

A compound expression can contain any number of logical and arithmetic operators. The following expression evaluates the length of an HTTP request on the basis of its URL and cookie, evaluates text in the header, and performs a Boolean AND on these two results:

http.req.url.length + http.req.cookie.length <= 500 && http.req.header.contains("some text")

Page 59
Image 59
Citrix Systems 9.2 manual Compound Advanced Expressions, Basic Types of Operations