Fortinet white logo
Fortinet white logo

Script Reference Guide

HTTP:persist(read_tbl)

HTTP:persist(read_tbl)

Reads the stick table content according to the hash_value.

Syntax

HTTP:persist(t);

Arguments

Name Description

t

A table specifies the operation and hash value.

Events

Applicable in the following events:

  • PERSISTENCE

  • HTTP_REQUEST (supported since version 7.2.x)

Example

when PERSISTENCE{
  	t={};
	t["operation"] = "save_tbl";
	t["hash_value"] = "246810";
	t["srv_name"] = "pool1-3";
	ret = HTTP: persist(t);
	if ret then
	    debug("===server add success\n");
    else
        debug("===server add fail\n");
    end

    t={}
    t["operation"] = "read_tbl"
    t["hash_value"] = "246810"
    ret_tbl = HTTP:persist(t)
    if ret_tbl then
        debug("246810-server: %s\n",ret_tbl)
    else
        debug("246810-server read fail\n")
end 
}
Output:
	Return server name of the entry, or false if no entry found

Supported Version

FortiADC version 5.4.x and later. In 7.2.x, function extended to HTTP_REQUEST events.

HTTP:persist(read_tbl)

HTTP:persist(read_tbl)

Reads the stick table content according to the hash_value.

Syntax

HTTP:persist(t);

Arguments

Name Description

t

A table specifies the operation and hash value.

Events

Applicable in the following events:

  • PERSISTENCE

  • HTTP_REQUEST (supported since version 7.2.x)

Example

when PERSISTENCE{
  	t={};
	t["operation"] = "save_tbl";
	t["hash_value"] = "246810";
	t["srv_name"] = "pool1-3";
	ret = HTTP: persist(t);
	if ret then
	    debug("===server add success\n");
    else
        debug("===server add fail\n");
    end

    t={}
    t["operation"] = "read_tbl"
    t["hash_value"] = "246810"
    ret_tbl = HTTP:persist(t)
    if ret_tbl then
        debug("246810-server: %s\n",ret_tbl)
    else
        debug("246810-server read fail\n")
end 
}
Output:
	Return server name of the entry, or false if no entry found

Supported Version

FortiADC version 5.4.x and later. In 7.2.x, function extended to HTTP_REQUEST events.