There are parameters that affect the session timeout: the SessionTimeout
and TimeoutMs
parameters of the HTTP mode configuration file and the X-KAV-Timeout
request header. This section explains how to configure the session timeout for Kaspersky Scan Engine in HTTP mode by using these values.
SessionTimeout
This parameter of the configuration file sets the maximum time that Kaspersky Scan Engine can spend on receiving a scan request for an object and on processing this request (scanning operation), in milliseconds. This timeout is valid for all objects sent to Kaspersky Scan Engine.
Consider the following example: the value of SessionTimeout
is set to 4000
(four seconds), and the request does not contain the X-KAV-Timeout
header. Kaspersky Scan Engine spends one second on receiving the request. Then Kaspersky Scan Engine spends the remaining three seconds on scanning.
X-KAV-Timeout
This header sets the time that Kaspersky Scan Engine can spend on a scanning operation (in milliseconds), regardless of the value of the SessionTimeout
parameter.
The range of values for this parameter is from 0
to 4294967295
(an unsigned 32-bit integer).
Consider the following example: the value of SessionTimeout
is set to 4000
(four seconds), and the value of X-KAV-Timeout
is set to 10000
(10 seconds). Kaspersky Scan Engine spends one second on receiving the request. Then Kaspersky Scan Engine spends 10 seconds (which is the value of X-KAV-Timeout
) on scanning.
If SessionTimeout
is exceeded during the reception of the request, the session is closed, regardless of the value of X-KAV-Timeout
.
Consider the following example: the value of SessionTimeout
is set to 4000
(four seconds), and the value of X-KAV-Timeout
is set to 10000
(10 seconds). Kaspersky Scan Engine spends four seconds on receiving the request, and the session is closed because SessionTimeout
is exceeded.
You can choose the value of X-KAV-Timeout
on the basis of the size of the files that you want to scan. For example, Kaspersky Scan Engine could require 10 seconds to scan a large file, or 0.1 seconds to scan a small one.
TimeoutMs
By default, Kaspersky Scan Engine supports Keep-Alive connections, so it can process multiple objects one after another, by using the same connection.
For each new object, Kaspersky Scan Engine starts the new SessionTimeout
. After Kaspersky Scan Engine sends scan results, it keeps the connection open for as much time as TimeoutMs
specifies, even if the SessionTimeout
time has already expired. If a new object was received before TimeoutMs
expired, the new SessionTimeout
begins while the same connection remains open.
If Keep-Alive connections support is disabled, Kaspersky Scan Engine closes the connection after the SessionTimeout
time is expired.