support more range specifiers in ranged gets
This commit is contained in:
parent
dbf1e64d44
commit
9efd12c43c
2 changed files with 7 additions and 2 deletions
|
|
@ -237,7 +237,10 @@ class ResponseObject(_TemplateEnvironmentMixin):
|
|||
begin = 0
|
||||
end = None
|
||||
if 'range' in request.headers:
|
||||
begin, end = map(int, request.headers.get('range').split('-'))
|
||||
_, rspec = request.headers.get('range').split('=')
|
||||
if ',' in rspec:
|
||||
raise NotImplementedError("Multiple range specifiers not supported")
|
||||
begin, end = map(lambda i: int(i) if i else None, rspec.split('-'))
|
||||
|
||||
if isinstance(response, six.string_types):
|
||||
return 200, headers, response[begin:end]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue