This class inherits from net.Server
.
Variables
headersTimeout:Int
Limit the amount of time the parser will wait to receive the complete HTTP headers.
In case of inactivity, the rules defined in server.timeout
apply.
However, that inactivity based timeout would still allow the connection to be kept open
if the headers are being sent very slowly (by default, up to a byte per 2 minutes).
In order to prevent this, whenever header data arrives an additional check is made that
more than server.headersTimeout
milliseconds has not passed since the connection was established.
If the check fails, a 'timeout'
event is emitted on the server object, and (by default) the socket is destroyed.
See server.timeout for more information on how timeout behavior can be customized.
Default: 40000
keepAliveTimeout:Int
The number of milliseconds of inactivity a server needs to wait for additional incoming data,
after it has finished writing the last response, before a socket will be destroyed.
If the server receives new data before the keep-alive timeout has fired, it will reset the regular inactivity timeout, i.e., server.timeout
.
A value of 0
will disable the keep-alive timeout behavior on incoming connections
A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections.
Default: 5000
(5 seconds).
maxHeadersCount:Null<Int>
Limits maximum incoming headers count. If set to 0, no limit will be applied.
Default: 2000
timeout:Int
The number of milliseconds of inactivity before a socket is presumed to have timed out.
A value of 0
will disable the timeout behavior on incoming connections.
The socket timeout logic is set up on connection, so changing this value only affects new connections to the server, not any existing connections.
To change the default timeout use the --http-server-default-timeout
flag.
Default: 120000
(2 minutes)
Methods
setTimeout(msecs:Int, ?callback:Socket ‑> Void):Void
Sets the timeout value for sockets, and emits a 'timeout'
event on the Server object,
passing the socket as an argument, if a timeout occurs.
If there is a 'timeout'
event listener on the Server object, then it will be called with the timed-out socket as an argument.
By default, the Server's timeout value is 2 minutes, and sockets are destroyed automatically if they time out.
However, if a callback is assigned to the Server's 'timeout'
event, timeouts must be handled explicitly.
To change the default timeout use the --http-server-default-timeout
flag.