Os_payload_inspect::match_size(integer), Context, Usage – Brocade Virtual ADX OpenScript API Guide (Supporting ADX v03.1.00) User Manual

Page 127: Input parameters, Return values

Advertising
background image

Brocade Virtual ADX OpenScript API Guide

115

53-1003243-01

Methods

9

In the following example, when response content type is text, the script replaces all of the "correct"
strings with "valid", the "This" string with "That", and the "test" string with "TEST" in the response
payload .

OS_PAYLOAD_INSPECT::match_size(integer)

Sets the number of bytes of the match buffer.

Context

This function can be called from any event.

Usage

The match buffer is an internal, fixed-sized data buffer that performs the matching of the pattern.
This buffer is a user-defined, fixed-size payload segment of stream content where the contiguous
content is inspected.

The matching action for a regular expression pattern is limited to the size of the match buffer. The
matching algorithm can fail to return the correct result when a regular expression pattern matches
with the payload content that is larger than the size of the match buffer. The match pattern size
should be smaller than that of the match buffer.

Input parameters

The following table contains the input values.

Return values

None

TABLE 133

Input values

Name

Type

Description

integer

integer

The match buffer size in bytes. Enter an integer from 128 to 4096.
The default size is 1024.

use OS_PAYLOAD_INSPECT;

use OS_HTTP_RESPONSE;

sub HTTP_RESPONSE {

my $type = OS_HTTP_RESPONSE::content_type;

if (OS_HTTP_RESPONSE::content_type =~ /text/) {

OS_PAYLOAD_INSPECT::match("correct", "This", "test");

}

}

sub PAYLOAD_INSPECT_MATCHED {

OS_PAYLOAD_INSPECT::matched_replace("","valid","","That","","TEST");

}

Advertising