GS Cache: handle response of multipart range request.
Internally, We use multi-range request to extract files from a tar, e.g.
curl http://gs_cache/download/archive.tar \
-H 'Range: bytes=<file1_start>-<file1_end>,<file2_start>-<file2_end>'
The response is like:
HTTP/1.1 206 Partial Content
Content-Type: multipart/byteranges; boundary=magic_string
Content-Length: 282
--magic_string
Content-Type: text/html
Content-Range: bytes 0-50/1270
<data>
--magic_string
Content-Type: text/html
Content-Range: bytes 100-150/1270
<data>
--magic_string--
This change provides utils to convert this response to a series tuples
of (filename, file_content).
BUG=chromium:824580
TEST=Ran unit tests.
Change-Id: Ib6935aefbad17b76c378b268699af07723b25acf
Reviewed-on: https://chromium-review.googlesource.com/1090074
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Congbin Guo <guocb@chromium.org>
Reviewed-by: Congbin Guo <guocb@chromium.org>
diff --git a/gs_cache/constants.py b/gs_cache/constants.py
new file mode 100644
index 0000000..8c82faf
--- /dev/null
+++ b/gs_cache/constants.py
@@ -0,0 +1,8 @@
+# -*- coding: utf-8 -*-
+# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Some constants used by gs_cache."""
+
+READ_BUFFER_SIZE_BYTES = 1024 * 1024 # 1 MB