Merge pull request #1263 from coreos-inc/clair_lb_close_conn
Close Clair API connections
This commit is contained in:
commit
8d6b2f1580
1 changed files with 4 additions and 3 deletions
|
@ -246,18 +246,19 @@ class SecurityScannerAPI(object):
|
||||||
url = urljoin(api_url, relative_url)
|
url = urljoin(api_url, relative_url)
|
||||||
|
|
||||||
client = self.config['HTTPCLIENT']
|
client = self.config['HTTPCLIENT']
|
||||||
|
headers = {'Connection': 'close'}
|
||||||
timeout = security_config.get('API_TIMEOUT_SECONDS', 1)
|
timeout = security_config.get('API_TIMEOUT_SECONDS', 1)
|
||||||
|
|
||||||
with CloseForLongOperation(self.config):
|
with CloseForLongOperation(self.config):
|
||||||
if method == 'POST':
|
if method == 'POST':
|
||||||
logger.debug('POSTing security URL %s', url)
|
logger.debug('POSTing security URL %s', url)
|
||||||
return client.post(url, json=body, params=params, timeout=timeout, cert=self._keys,
|
return client.post(url, json=body, params=params, timeout=timeout, cert=self._keys,
|
||||||
verify=self._certificate)
|
verify=self._certificate, headers=headers)
|
||||||
elif method == 'DELETE':
|
elif method == 'DELETE':
|
||||||
logger.debug('DELETEing security URL %s', url)
|
logger.debug('DELETEing security URL %s', url)
|
||||||
return client.delete(url, params=params, timeout=timeout, cert=self._keys,
|
return client.delete(url, params=params, timeout=timeout, cert=self._keys,
|
||||||
verify=self._certificate)
|
verify=self._certificate, headers=headers)
|
||||||
else:
|
else:
|
||||||
logger.debug('GETing security URL %s', url)
|
logger.debug('GETing security URL %s', url)
|
||||||
return client.get(url, params=params, timeout=timeout, cert=self._keys,
|
return client.get(url, params=params, timeout=timeout, cert=self._keys,
|
||||||
verify=self._certificate)
|
verify=self._certificate, headers=headers)
|
||||||
|
|
Reference in a new issue