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
This commit is contained in:
Hongbin Lu
2018-09-05 02:23:21 +00:00
parent cdfcab0d72
commit b62af4dd69

View File

@@ -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