HTTP::is_keepalive

Description

Returns a true value if this is a Keep-Alive connection.

Syntax

HTTP::is_keepalive

HTTP::is_keepalive

  • Returns a true value if this is a ‘’’Keep-Alive* connection. This command is the synonymous with HTTP::header is_keepalive.

Examples

when HTTP_RESPONSE {
  if {[HTTP::is_keepalive]}{
    HTTP::close
  }
}

when HTTP_REQUEST {
  # Force downgrade to HTTP 1.0, but still allow keep-alive connections.
  # Since 1.1 is keep-alive by default, and 1.0 isn't,
  # we need make sure the headers reflect the keep-alive status.
  if {[HTTP::version] == "1.1"} {
    if {[HTTP::is_keepalive]} {
      HTTP::header replace "Connection" "Keep-Alive"
    }
    HTTP::version "1.0"
  }
}