topdown: Prevent unnecesssary client creation and disable HTTP keep-alives
topdown: Prevent unnecesssary client creation and disable HTTP keep-alives

This commit includes two fixes to the http.send built-in:

1) Prevent inter-query cache from creating client on every request

The http.send inter-query cache creates a http.client on every request
even if the response is cached and fresh. This change prevents this
from happening as it's not required.

2) Disable HTTP keep-alives

Currently http.send uses the http.DefaultTransport instance
while creating a http client on every unique request. Since we
do not set the keep-alive timeout for a connection,
the default value (90 secs) is used. When a policy is queried
hundreds or thousands of times per second, these new connections
stay open till their idle connection timeout is reached. Eventually
connection resource utilization adds up resulting in errors
such as "too many openfiles". This change attempts to fix this
by disabling HTTP keep-alives.

Fixes: #4015
Fixes: #4016

Signed-off-by: Ashutosh Narkar <334e9094b46d3151817f829cebfa78d0453b0333@gmail.com>

tsandall/opa,open-policy-agent/opa,open-policy-agent/opa,open-policy-agent/opa,open-policy-agent/opa,tsandall/opa,tsandall/opa,tsandall/opa,tsandall/opa,tsandall/opa,open-policy-agent/opa,open-policy-agent/opa