Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.