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

Wrap string bodies as StringIO #780

Closed
wants to merge 1 commit into from

Conversation

JordonPhillips
Copy link
Contributor

There was an issue where young buckets would fail to PUT when virtual host addressing was used and when the body was a string of a few MB. This was because urllib3 will send the body as a separate request on file-like objects, but not on strings. S3 sends back a redirect after the initial request. When we're using two requests, we see the redirect before sending the body. When using small strings, S3 will redirect it for us. But when using long strings, we will continue sending data until S3 closes the connection on us, resulting in an exception.

This commit fixes the issue by wrapping string bodies in a StringIO object, which is a file-like object.

There was an issue where young buckets would fail to PUT  when
virtual host addressing was used and when the body was a string of a
few MB. This was because urllib3 will send the body as a separate
request on file-like objects, but not on strings. S3 sends back a
redirect after the initial request. When we're using two requests,
we see the redirect before sending the body. When using small strings,
S3 will redirect it for us. But when using long strings, we will
continue sending data until S3 closes the connection on us, resulting
in an exception.

This commit fixes the issue by wrapping string boddies in a StringIO
object, which is a file-like object.
@JordonPhillips
Copy link
Contributor Author

Closing this as I discovered some large issues with the current setup.

@JordonPhillips JordonPhillips deleted the broken-pipe branch March 21, 2016 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant