base/utils/active-http.zeek

ActiveHTTP

A module for performing active HTTP requests and getting the reply at runtime.

Namespace

ActiveHTTP

Imports

base/utils/exec.zeek

Summary

Runtime Options

ActiveHTTP::default_max_time: interval &redef

The default timeout for HTTP requests.

ActiveHTTP::default_method: string &redef

The default HTTP method/verb to use for requests.

Types

ActiveHTTP::Request: record

ActiveHTTP::Response: record

Functions

ActiveHTTP::request: function

Perform an HTTP request according to the ActiveHTTP::Request record.

Detailed Interface

Runtime Options

ActiveHTTP::default_max_time
Type

interval

Attributes

&redef

Default

1.0 min

The default timeout for HTTP requests.

ActiveHTTP::default_method
Type

string

Attributes

&redef

Default

"GET"

The default HTTP method/verb to use for requests.

Types

ActiveHTTP::Request
Type

record

url: string

The URL being requested.

method: string &default = ActiveHTTP::default_method &optional

The HTTP method/verb to use for the request.

client_data: string &optional

Data to send to the server in the client body. Keep in mind that you will probably need to set the method field to “POST” or “PUT”.

max_time: interval &default = ActiveHTTP::default_max_time &optional

Timeout for the request.

addl_curl_args: string &optional

Additional curl command line arguments. Be very careful with this option since shell injection could take place if careful handling of untrusted data is not applied.

ActiveHTTP::Response
Type

record

code: count

Numeric response code from the server.

msg: string

String response message from the server.

body: string &optional

Full body of the response.

headers: table [string] of string &optional

All headers returned by the server.

Functions

ActiveHTTP::request
Type

function (req: ActiveHTTP::Request) : ActiveHTTP::Response

Perform an HTTP request according to the ActiveHTTP::Request record. This is an asynchronous function and must be called within a “when” statement.

Parameters

req – A record instance representing all options for an HTTP request.

Returns

A record with the full response message.