From b62af4dd69c77440ff948388df90514e7dcdf635 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Wed, 5 Sep 2018 02:23:21 +0000 Subject: [PATCH] Encode injected file data (client-side) In before, we sent raw file data from client to server over HTTP. This commit encode injected file data by using RFC 3548 that are suitable for binary data sent as part of an HTTP request. The file will be encoded at client side before sending it to server. The encoded data will be decoded at server side before injecting into the container. This commit did the client-side encoding. Depends-On: I1ae959778f904dc52f102721558c2ede0ca2e09e Change-Id: I41838ccc5c0b5e01d84195cd27f1f5e4dbe84a78 --- zunclient/common/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zunclient/common/utils.py b/zunclient/common/utils.py index c8a75084..55590ee3 100644 --- a/zunclient/common/utils.py +++ b/zunclient/common/utils.py @@ -248,7 +248,7 @@ def parse_mounts(mounts): # TODO(hongbin): handle the case that 'source' is a directory filename = mount_info.pop('source') with open(filename, 'rb') as file: - mount_info['source'] = file.read() + mount_info['source'] = encode_file_data(file.read()) parsed_mounts.append(mount_info) return parsed_mounts