From 672168ce786007892d7c11f10178508fe62ddebd Mon Sep 17 00:00:00 2001 From: Quentin Machu Date: Mon, 29 Feb 2016 13:08:49 -0500 Subject: [PATCH] Close Clair API connections This forces every API calls to be load-balanced properly. --- util/secscan/api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/secscan/api.py b/util/secscan/api.py index 4fc652b06..3e1d72cd0 100644 --- a/util/secscan/api.py +++ b/util/secscan/api.py @@ -246,18 +246,19 @@ class SecurityScannerAPI(object): url = urljoin(api_url, relative_url) client = self.config['HTTPCLIENT'] + headers = {'Connection': 'close'} timeout = security_config.get('API_TIMEOUT_SECONDS', 1) with CloseForLongOperation(self.config): if method == 'POST': logger.debug('POSTing security URL %s', url) return client.post(url, json=body, params=params, timeout=timeout, cert=self._keys, - verify=self._certificate) + verify=self._certificate, headers=headers) elif method == 'DELETE': logger.debug('DELETEing security URL %s', url) return client.delete(url, params=params, timeout=timeout, cert=self._keys, - verify=self._certificate) + verify=self._certificate, headers=headers) else: logger.debug('GETing security URL %s', url) return client.get(url, params=params, timeout=timeout, cert=self._keys, - verify=self._certificate) + verify=self._certificate, headers=headers)