mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-19 03:06:33 +00:00
Don't send header if it makes no sense to do so.
This commit is contained in:
parent
b049d4a792
commit
7466ee25a8
@ -329,8 +329,11 @@ class HTTPServer(object):
|
|||||||
data = bucket.read(offset, end - offset)
|
data = bucket.read(offset, end - offset)
|
||||||
|
|
||||||
request.setResponseCode(http.PARTIAL_CONTENT)
|
request.setResponseCode(http.PARTIAL_CONTENT)
|
||||||
request.setHeader(
|
if len(data):
|
||||||
"content-range",
|
# For empty bodies the content-range header makes no sense since
|
||||||
ContentRange("bytes", offset, offset + len(data)).to_header(),
|
# the end of the range is inclusive.
|
||||||
)
|
request.setHeader(
|
||||||
|
"content-range",
|
||||||
|
ContentRange("bytes", offset, offset + len(data)).to_header(),
|
||||||
|
)
|
||||||
return data
|
return data
|
||||||
|
Loading…
Reference in New Issue
Block a user