Skip to content

Commit 405c966

Browse files
committed
Compress default rules payload before sending
1 parent 83cdcfe commit 405c966

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sdcclient/secure/_falco_rules_files_old.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import shutil
44

55
import yaml
6+
import zlib
67

78
from sdcclient._common import _SdcCommon
89

@@ -309,8 +310,12 @@ def _set_falco_rules_files(self, kind, rules_files):
309310
if "defaultPolicies" in rules_files:
310311
obj["defaultPolicies"] = rules_files["defaultPolicies"]
311312

312-
res = self.http.put(self.url + '/api/settings/falco/{}RulesFiles'.format(kind), headers=self.hdrs,
313-
data=json.dumps(payload[1]), verify=self.ssl_verify)
313+
headers = self.hdrs
314+
headers['content-encoding'] = 'gzip'
315+
data = zlib.compress(json.dumps(payload[1]))
316+
317+
res = self.http.put(self.url + '/api/settings/falco/{}RulesFiles'.format(kind), headers,
318+
data, verify=self.ssl_verify)
314319
if not self._checkResponse(res):
315320
return [False, self.lasterr]
316321
return [True, res.json()]

0 commit comments

Comments
 (0)