dlo: Respond 200 on multi-range GETs
We already had a unit test for this, but it was inadvertently retesting what test_get_suffix_range_many_segments tested. Change-Id: I43eee7029ca884268c3f2ad74300b94b299fd8d2 Closes-Bug: #1831790 (cherry picked from commita21c0be70c
) (cherry picked from commitb3cc7417e0
) (cherry picked from commit6a02cac444
)
This commit is contained in:
parent
8d33e22606
commit
e738aa47f8
|
@ -281,6 +281,8 @@ class GetContext(WSGIContext):
|
|||
actual_content_length = None
|
||||
content_length_for_swob_range = None
|
||||
req.range = None
|
||||
else:
|
||||
req.range = None
|
||||
|
||||
response_headers = [
|
||||
(h, v) for h, v in response_headers
|
||||
|
|
|
@ -118,6 +118,15 @@ class TestDlo(Base):
|
|||
file_contents = file_item.read(size=1, offset=47)
|
||||
self.assertEqual(file_contents, "e")
|
||||
|
||||
def test_get_multiple_ranges(self):
|
||||
file_item = self.env.container.file('man1')
|
||||
file_contents = file_item.read(
|
||||
hdrs={'Range': 'bytes=0-4,10-14'})
|
||||
self.assert_status(200) # *not* 206
|
||||
self.assertEqual(
|
||||
file_contents,
|
||||
b"aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeee")
|
||||
|
||||
def test_get_range_out_of_range(self):
|
||||
file_item = self.env.container.file('man1')
|
||||
|
||||
|
|
|
@ -476,14 +476,14 @@ class TestDloGetManifest(DloTestCase):
|
|||
def test_get_multi_range(self):
|
||||
# DLO doesn't support multi-range GETs. The way that you express that
|
||||
# in HTTP is to return a 200 response containing the whole entity.
|
||||
req = swob.Request.blank('/v1/AUTH_test/mancon/manifest-many-segments',
|
||||
req = swob.Request.blank('/v1/AUTH_test/mancon/manifest',
|
||||
environ={'REQUEST_METHOD': 'GET'},
|
||||
headers={'Range': 'bytes=5-9,15-19'})
|
||||
with mock.patch(LIMIT, 3):
|
||||
with mock.patch(LIMIT, 30):
|
||||
status, headers, body = self.call_dlo(req)
|
||||
headers = HeaderKeyDict(headers)
|
||||
self.assertEqual(status, "200 OK")
|
||||
self.assertIsNone(headers.get("Content-Length"))
|
||||
self.assertEqual(headers.get("Content-Length"), '25')
|
||||
self.assertIsNone(headers.get("Content-Range"))
|
||||
self.assertEqual(body, "aaaaabbbbbcccccdddddeeeee")
|
||||
|
||||
|
|
Loading…
Reference in New Issue