controlshift/aws-sdk-ruby — pull request #1 by anero (2014-12-10 17:56:58+00:00)
Title: Addressing S3 write timeout bug.

Net::HTTP has a few bugs regarding Expect-100 continue and how it
retries idempotent HTTP requests. This commit enables two patches
that address these issues. Without these patches, the user may
experience S3 timeout issues.

Unfortunately this built-in retry logic is buggy; When *some* of the
body is sent before a network failure, it fails to rewind the body
before sending the retry. This results in a partial body, that is
fewer than "Content-Length" bytes. S3 eventually times out the
request waiting for all of the bytes.

This commit makes two major changes to avoid this scenario:

* It enables the expect-100 continue HTTP logic BEFORE sending
bytes to Amazon S3. This eliminates most of the common failure
scenarios where bytes are sent and the request broken by the
remote end (especially for auth-erors).

* It patches the Net::HTTP transport method to rewind the
request body stream if the body responds to #rewind before
attempting a retry.

Previously, the 100-continue bheavior and the 2nd patch were
opt-in, but this problematic enough for Ruby 2 users that this
enables this by default.

See #241