Input parameters, Return values, Example – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual

Page 124

Advertising
background image

112

Brocade Virtual ADX OpenScript API Guide

53-1003243-01

Methods

9

Input parameters

The following table contains the input values.

Return values

None

Example

In this example, based on the match of the member-level keyword in the payload (only one type of
member will appear in the payload), the script replaces all of the "login.php" strings with a different
member PHP string. If a request contains the "gold_member" string in the payload, the script
converts all of the "login.php" strings in the payload to "gold_login.php." If a request contains the
"basic_member" string in the payload, the script converts all of the "login.php" strings in the
payload to "basic_login.php." If a request contains the "visitor" string in the payload, the script
converts all of the "login.php" strings in the payload to "no_login.php."

TABLE 131

Input values

Name

Type

Description

regexp1

regular expression

The regular expression to match with a maximum length of
128 bytes.

regexp2

regular expression

An optional additional regular expression to match with a maximum
length of 128 bytes.

regexp3

regular expression

An optional additional regular expression to match with a maximum
length of 128 bytes.

use OS_HTTP_REQUEST;

use OS_PAYLOAD_INSPECT;

sub HTTP_REQUEST {

if (OS_HTTP_REQUEST::url =~ /login/) {

OS_PAYLOAD_INSPECT::match(

‘gold_member’,

‘basic_member’,

‘visitor’

);

}

}

sub PAYLOAD_INSPECT_MATCHED {

OS_PAYLOAD_INSPECT::matched_replace(

‘login.php’, ‘gold_login.php’,

‘login.php’, ‘basic_login.php’,

‘login.php’, ‘no_login.php’

)

}

Advertising