Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #432. Read the response from httplib even if there is a 0 ... #496

Merged
merged 2 commits into from
Mar 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion S3/S3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,11 @@ def recv_file(self, request, stream, labels, start_position = 0, retries = _max_
progress.current_position = current_position

try:
# Fix for issue #432. Even when content size is 0, httplib expect the response to be read.
if size_left == 0:
data = http_response.read(1)
# It is not supposed to be some data returned in that case
assert(len(data) == 0)
while (current_position < size_total):
this_chunk = size_left > self.config.recv_chunk and self.config.recv_chunk or size_left

Expand All @@ -1323,7 +1328,7 @@ def recv_file(self, request, stream, labels, start_position = 0, retries = _max_

data = http_response.read(this_chunk)
if len(data) == 0:
raise S3Error("EOF from S3!")
raise S3ResponseError("EOF from S3!")

#throttle
if self.config.limitrate > 0:
Expand Down