Chapter 6 Advanced Expressions: Parsing HTTP, TCP, and UDP Data 125

Operations That Evaluate HTTP Headers

HTTP Header Operation

Description

 

 

http header.

An HTTP header can occur multiple times in a request

INSTANCE(instance

or a response. This operation returns the header that

number)

occurs instance number of places before the final

 

instance. For example, instance(0) selects the last

 

instance of the current type, instance(1) selects the

 

next-to-last instance, and so on. This prefix cannot be

 

used in bidirectional policies.

 

The instance number argument cannot exceed 14.

 

Following is an example of a request with two headers:

 

HTTP/1.1 200 OK\r\n

 

MyHeader: abc\r\n

 

Content-Length: 200\r\n

 

MyHeader: def\r\n

 

\r\n

 

The following returns a text object that refers to

 

"MyHeader: abc\r\n":

 

http.res.header("MyHeader").instance(1)

http header.

Extracts the text that matches the string argument. The

SUBSTR("string")

headers are evaluated from the last instance to the first.

 

Following is an example of a request with two headers

 

that contain the string “111”:

 

HTTP/1.1 200 OK\r\n

 

MyHeader: abc111\r\n

 

Content-Length: 200\r\n

 

MyHeader: 111def\r\n

 

\r\n

 

The following returns "111" from the last instance of

 

MyHeader. This is the header with the value "111def".

 

http.res.header("MyHeader").

 

substr("111")

Page 139
Image 139
Citrix Systems 9.2 Or a response. This operation returns the header that, Used in bidirectional policies, MyHeader abc\r\n