diff options
author | Christian Schwede <christian.schwede@enovance.com> | 2014-06-04 15:27:48 +0000 |
---|---|---|
committer | Christian Schwede <christian.schwede@enovance.com> | 2014-06-04 16:52:47 +0000 |
commit | 7056ec6a16fd8707564ec4b0a05cab461ee2a80d (patch) | |
tree | a890aac54eabb7b5e5e0b413811645d6d7e1b00b | |
parent | c384d76c575e28d045b86528fb5a6c67f0b8c518 (diff) | |
download | swift-7056ec6a16fd8707564ec4b0a05cab461ee2a80d.tar.gz |
Fix file uploads > 2 GiB in formpost middleware
Formpost middleware fails to upload files larger then 2 GiB due to
an Overflow error. The reason is that the readline() will use a
readline(int(content_length)) later on and fail if it is larger than
2GiB. Since it is not required to read the whole content into memory
to detect the boundary only read the amount of required bytes.
The underlying error is located in Python 2.7 and is related to
cStringIO: http://bugs.python.org/issue7358
Closes-Bug: #1326429
Change-Id: I196edda647921c2691d278cebd1cca80ebd360f2
-rw-r--r-- | swift/common/middleware/formpost.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/swift/common/middleware/formpost.py b/swift/common/middleware/formpost.py index b81b75d61..ba4de7af8 100644 --- a/swift/common/middleware/formpost.py +++ b/swift/common/middleware/formpost.py @@ -242,7 +242,7 @@ def _iter_requests(wsgi_input, boundary): :returns: A generator of file-like objects for each part. """ boundary = '--' + boundary - if wsgi_input.readline().strip() != boundary: + if wsgi_input.readline(len(boundary + '\r\n')).strip() != boundary: raise FormInvalid('invalid starting boundary') boundary = '\r\n' + boundary input_buffer = '' |