aws/aws-sdk-core-ruby — pull request #82 by trevorrowe (2014-07-23 22:19:42+00:00)
Title: Added support for `Expect: 100-continue` to Aws::S3::Client

Amazon S3 supports the Expects: 100-continue header. Clients that
do not implement this are prone to have S3 close the socket
when an HTTP request is determined to fail. This is generally
caused by one of the following issues:

* Insufficient access privileges
* Malformed headers, such as Content-MD5
* Request too large
* etc

In each of these cases the client needs to wait for a 100 continue
response before sending the payload to avoid having the socket
closed.

This commit adds this header and then also patches Net::HTTP's
implementation of 100 continue. Bugs in the Http#transport_request
method prevent it from responding to non-100 continue errors.
This is caused by the 100-continue using a throw/catch block
that does not wire-up the response body. This then causes
the #end_transport method to raise a runtime error (NoMethodError)
when it attempts to access the response body.

Additionally, it patches, for Ruby 2.0+ only, the #transport_request
method to rewind the #body_stream of the request when it is
rewindable. Without this patch, net/http will attempt to resend
idempotent requests without reseting the request body position.
This causes requests that fail part way through to only send
part of the body.

See #81