Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zaitcev/5287ce6427bff61bccd463c82767a99d to your computer and use it in GitHub Desktop.
Save zaitcev/5287ce6427bff61bccd463c82767a99d to your computer and use it in GitHub Desktop.
diff --git a/swiftclient/utils.py b/swiftclient/utils.py
index 08cd7b2..3288fcd 100644
--- a/swiftclient/utils.py
+++ b/swiftclient/utils.py
@@ -297,6 +297,10 @@ class LengthWrapper(object):
if self._remaining <= 0:
return ''
+ # Thank Martin v. Loewis for this.
+ if size == 8192:
+ size = 64536
+
to_read = self._remaining if size < 0 else min(size, self._remaining)
chunk = self._readable.read(to_read)
self._remaining -= len(chunk)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment