Fortinet white logo
Fortinet white logo

Script Reference Guide

HTTP:collect(t)

HTTP:collect(t)

Collects body data from the HTTP request or response. You may specify a specific amount using the length argument.

Syntax

HTTP:collect(t)

Arguments

Name Description

t

A table that specifies how much data to collect.

Operation

Instructs the system to buffer HTTP body data. This must be called before the data events (HTTP_DATA_REQUEST or HTTP_DATA_RESPONSE) can be processed.

Field

Type

Required

Description

size

Integer

Yes

The amount of HTTP body data to collect, in bytes.

Events

Applicable in the following events:

  • HTTP_REQUEST

  • HTTP_RESPONSE

Example

when HTTP_RESPONSE {
debug("Start\n")
t={}
t["size"]=10
HTTP:collect(t)
debug("Done\n")
}
when HTTP_DATA_RESPONSE {
table={}
table["operation"]="size"
ret=HTTP:payload(table)
debug("Size: %d \n",ret)
}

Note:

  • The actual amount collected may be limited by system constraints and the available data size.

  • The size parameter refers to the HTTP proxy block size, which is subject to FortiADC hardware limitations.

  • Must be called in HTTP_REQUEST or HTTP_RESPONSE events to enable data buffering for subsequent HTTP_DATA_REQUEST or HTTP_DATA_RESPONSE events.

.

Supported Version

FortiADC version 4.8.x and later.

HTTP:collect(t)

HTTP:collect(t)

Collects body data from the HTTP request or response. You may specify a specific amount using the length argument.

Syntax

HTTP:collect(t)

Arguments

Name Description

t

A table that specifies how much data to collect.

Operation

Instructs the system to buffer HTTP body data. This must be called before the data events (HTTP_DATA_REQUEST or HTTP_DATA_RESPONSE) can be processed.

Field

Type

Required

Description

size

Integer

Yes

The amount of HTTP body data to collect, in bytes.

Events

Applicable in the following events:

  • HTTP_REQUEST

  • HTTP_RESPONSE

Example

when HTTP_RESPONSE {
debug("Start\n")
t={}
t["size"]=10
HTTP:collect(t)
debug("Done\n")
}
when HTTP_DATA_RESPONSE {
table={}
table["operation"]="size"
ret=HTTP:payload(table)
debug("Size: %d \n",ret)
}

Note:

  • The actual amount collected may be limited by system constraints and the available data size.

  • The size parameter refers to the HTTP proxy block size, which is subject to FortiADC hardware limitations.

  • Must be called in HTTP_REQUEST or HTTP_RESPONSE events to enable data buffering for subsequent HTTP_DATA_REQUEST or HTTP_DATA_RESPONSE events.

.

Supported Version

FortiADC version 4.8.x and later.