Fall back to streaming

This commit is contained in:
Skipper Seabold
2016-06-17 13:27:02 -05:00
committed by Nate Prewitt
parent d4965a4ec6
commit 8873a09097
+5 -1
View File
@@ -83,7 +83,8 @@ def super_len(o):
# is actually a special file descriptor like stdin. In this
# instance, we don't know what the length is, so set it to zero and
# let requests chunk it instead.
current_position = total_length
if total_length is not None:
current_position = total_length
if hasattr(o, 'seek') and total_length is None:
# StringIO has a notimplemented fileno
@@ -98,6 +99,9 @@ def super_len(o):
# seek back to current position to support partially read file-like
o.seek(current_position or 0)
if total_length is None:
total_length = 0
return max(0, total_length - current_position)