HTTP commands
The HTTP scripting class includes basic functions for manipulating HTTP elements and other important functions:
-
HTTP:header_get_names() — Returns a list of all the headers present in the request or response.
-
HTTP:header_get_values(header_name) — Returns a list of value(s) of the HTTP header named <header_name>, with a count for each value.
-
HTTP:header_get_value(header_name) — Returns the value of the HTTP header named <header_name>.
-
HTTP:header_remove(header_name) — Removes all headers named with the name <header_name>.
-
HTTP:header_remove2(header_name, countid) — Returns a count ID for each item.
-
HTTP:header_insert(header_name, value) — Inserts the header <header_name> with value <value> into the end of the HTTP request or response.
-
HTTP:header_replace(header_name, value) — Replaces the occurrence value of header <header_name> with value <value>.
-
HTTP:header_replace2(header_name, value, countid) — Header_get_values() returns a count ID for each item.
-
HTTP:header_exists(header_name) — Returns true when the header <header_name> exists and false when it does not exist.
-
HTTP:header_count(header_name) — Returns the integer counter of the header <header_name>.
-
HTTP:method_get() — Returns the string of the HTTP request method.
-
HTTP:method_set(value) — Sets the HTTP request method to the string <value>.
-
HTTP:path_get() — Returns the string of the HTTP request path.
-
HTTP:path_set(value) — Sets HTTP request path to the string <value>.
-
HTTP:uri_get() — Returns the string of the HTTP request URI.
-
HTTP:uri_set(value) — Sets the HTTP request URI to the string <value>.
-
HTTP:query_get() — Returns the string of the HTTP request query.
-
HTTP:query_set(value) — Sets the HTTP request query to the string <value>.
-
HTTP:redirect(“url”, …) — Redirects an HTTP request or response to the specified URL.
-
HTTP:redirect_with_cookie(url, cookie) — Redirects an HTTP request or response to the specified URL with cookie.
-
HTTP:redirect_t(t) — Redirects an HTTP request or response to the URL specified in the table.
-
HTTP:version_get() — Returns the HTTP version of the request or response.
-
HTTP:version_set(value) — Sets the HTTP request or response version to the string <value>.
-
HTTP:status_code_get() — Returns the response status code output as string.
-
HTTP:status_code_set(value) — Sets the HTTP response status code.
-
HTTP:code_get() — Returns the response status code, output as integer.
-
HTTP:code_set(integer) — Sets the response status code.
-
HTTP:reason_get() — Returns the response reason.
-
HTTP:reason_set(value) — Sets the response reason.
-
HTTP:client_addr() — Returns the client IP address of a connection.
-
HTTP:local_addr() — For HTTP_REQUEST, returns the IP address of the virtual server the client is connected to; for HTTP_RESPONSE, returns the incoming interface IP address of the return packet.
-
HTTP:server_addr() — Returns the IP address of the server in HTTP_RESPONSE.
-
HTTP:remote_addr() — Returns the IP address of the host on the far end of the connection.
-
HTTP:client_port() — Returns real client port number in a string format.
-
HTTP:local_port() — Returns the local port number in a string format.
-
HTTP:remote_port() — Returns the remote port number in a string format.
-
HTTP:server_port() — Returns the real server port number in a string format.
-
HTTP:client_ip_ver() — Returns the client IP version number. This can be used to get IPv4 or IPv6 versions.
-
HTTP:server_ip_ver() — Returns the server IP version number. This can be used to get IPv4 or IPv6 versions.
-
HTTP:close() — Close an HTTP connection using code 503.
-
HTTP:respond(t) — Allows you to return a customized page and send out an HTTP response directly from FortiADC.
-
HTTP:respond_errorfile — Allows the HTTP to respond with a specified error file. This function returns Boolean true if successful otherwise, returns Boolean false.
-
HTTP:get_session_id() — FortiADC will assign each session a unique ID and allow the user to get this unique ID through this function.
-
HTTP:rand_id() — Returns a random string of 32 characters long in hex format.
-
HTTP:set_event(t) — Sets a request or response event to enable or disable.
-
HTTP:set_auto() — Sets an automatic request or response event.
-
HTTP:get_unique_session_id() — Returns a unique ID per session in history. Each ID is a string consisting of 32 hex digits, for example "b6e49ca3c937baaa47f2d111f593be8b".
-
HTTP:get_unique_transaction_id() — Returns a unique ID per transaction in history. Each ID is a string consisting of 32 hex digits, for example "b0b9fec0b4b28306a2bf4f63eb97520e".
-
HTTP:disable_event() — Disables an event based on the code specified via the parameter.
-
HTTP:enable_event() — Enables an event that was previously disabled based on the code specified via the parameter.