From f91d986e26dd1b44a6c05cb37f27eddb89938c4b Mon Sep 17 00:00:00 2001 From: Grant Ammons Date: Wed, 3 Aug 2011 15:15:46 -0400 Subject: [PATCH] fix issue where user is potentially using both aws-s3 and net_http_connection gems --- lib/net_fix.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/net_fix.rb b/lib/net_fix.rb index ad54f8a..fe7af80 100644 --- a/lib/net_fix.rb +++ b/lib/net_fix.rb @@ -82,7 +82,14 @@ def exec(sock, ver, path, send_only=nil) #:nodoc: internal use only if @body send_request_with_body sock, ver, path, @body, send_only elsif @body_stream - send_request_with_body_stream sock, ver, path, @body_stream, send_only + begin + send_request_with_body_stream sock, ver, path, @body_stream, send_only + rescue ArgumentError + # this rescue is called when users have both net_http_connection and aws-s3 gem installed. + # For whatever reason, sometimes this method gets redefined by aws-s3 (depending on load order) + # the aws-s3 gem only has 4 options, not 5, so users see an ArgumentError (5 for 4) when this gets called. + send_request_with_body_stream sock, ver, path, @body_stream + end else write_header(sock, ver, path) end