mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 10:46:24 +00:00
Just require content-range for simplicity.
This commit is contained in:
parent
d38183335e
commit
ecb1a3c5a0
@ -540,7 +540,7 @@ Rejected designs for upload secrets:
|
||||
Write data for the indicated share.
|
||||
The share number must belong to the storage index.
|
||||
The request body is the raw share data (i.e., ``application/octet-stream``).
|
||||
*Content-Range* requests are encouraged for large transfers to allow partially complete uploads to be resumed.
|
||||
*Content-Range* requests are required; for large transfers this allows partially complete uploads to be resumed.
|
||||
For example,
|
||||
a 1MiB share can be divided in to eight separate 128KiB chunks.
|
||||
Each chunk can be uploaded in a separate request.
|
||||
|
@ -240,16 +240,13 @@ class HTTPServer(object):
|
||||
"""Write data to an in-progress immutable upload."""
|
||||
content_range = parse_content_range_header(request.getHeader("content-range"))
|
||||
if content_range is None or content_range.units != "bytes":
|
||||
# TODO Missing header means full upload in one request
|
||||
request.setResponseCode(http.REQUESTED_RANGE_NOT_SATISFIABLE)
|
||||
return b""
|
||||
|
||||
|
||||
offset = content_range.start
|
||||
|
||||
|
||||
# TODO basic check that body isn't infinite. require content-length? or maybe we should require content-range (it's optional now)? if so, needs to be rflected in protocol spec.
|
||||
|
||||
data = request.content.read()
|
||||
# TODO limit memory usage
|
||||
data = request.content.read(content_range.stop - content_range.start + 1)
|
||||
try:
|
||||
bucket = self._uploads[storage_index].shares[share_number]
|
||||
except (KeyError, IndexError):
|
||||
|
Loading…
Reference in New Issue
Block a user