<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 trunk:
 
+- Bug #17458 fixed. Normalize the :expires_in option to always be an integer even if the actual object passed in is a proxy to an integer, such as is the case with 2.hours from ActiveSupport which is actually an instance of ActiveSupport::Duration. Reported by [Steve Kickert steve@riverocktech.com]
+
 - Bug #19158 fixed. Don't prepend leading slash onto bucket name when deleting a bucket with the :force =&gt; true option.
 
 - Bug #17628 fixed. Don't ignore :use_ssl =&gt; false in url_for when the connection is established over ssl. Reported by [Tom Fixed (tkat11)]</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -50,7 +50,7 @@ module AWS
       # parameterize these computations and arrange them in a string form appropriate to how they are used, in one case a http request
       # header value, and in the other case key/value query string parameter pairs.
       class Signature &lt; String #:nodoc:
-        attr_reader :request, :access_key_id, :secret_access_key
+        attr_reader :request, :access_key_id, :secret_access_key, :options
   
         def initialize(request, access_key_id, secret_access_key, options = {})
           super()
@@ -99,10 +99,9 @@ module AWS
       # More details about the various authentication schemes can be found in the docs for its containing module, Authentication.
       class QueryString &lt; Signature #:nodoc:
         constant :DEFAULT_EXPIRY, 300 # 5 minutes
-        
         def initialize(*args)
           super
-          @options[:url_encode] = true
+          options[:url_encode] = true
           self &lt;&lt; build
         end
         
@@ -115,8 +114,12 @@ module AWS
           #      the +:expires_in+ option
           #   3) The current time in seconds since the epoch plus the default number of seconds (60 seconds)
           def expires
-            return @options[:expires] if @options[:expires]
-            date.to_i + (@options[:expires_in] || DEFAULT_EXPIRY)
+            return options[:expires] if options[:expires]
+            date.to_i + expires_in
+          end
+          
+          def expires_in
+            options.has_key?(:expires_in) ? Integer(options[:expires_in]) : DEFAULT_EXPIRY
           end
           
           # Keep in alphabetical order</diff>
      <filename>lib/aws/s3/authentication.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,7 +30,25 @@ class QueryStringAuthenticationTest &lt; Test::Unit::TestCase
     query_string = Authentication::QueryString.new(request, key_id, secret, :expires =&gt; expires)
     assert_equal expires, query_string.send(:canonical_string).instance_variable_get(:@options)[:expires]
     assert_equal AmazonDocExampleData::Example3.query_string, query_string
-  end    
+  end
+  
+  def test_expires_in_is_coerced_to_being_an_integer_in_case_it_is_a_special_integer_proxy
+    # References bug: http://rubyforge.org/tracker/index.php?func=detail&amp;aid=17458&amp;group_id=2409&amp;atid=9356
+    integer_proxy = Class.new do
+      attr_reader :integer
+      def initialize(integer)
+        @integer = integer
+      end
+      
+      def to_int
+        integer
+      end
+    end
+    
+    actual_integer = 25
+    query_string = Authentication::QueryString.new(request, key_id, secret, :expires_in =&gt; integer_proxy.new(actual_integer))
+    assert_equal actual_integer, query_string.send(:expires_in)
+  end
   
   private
     def request; AmazonDocExampleData::Example3.request end</diff>
      <filename>test/authentication_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>68cd7562a2fcec7a89e83fea4448b3b82d5688d1</id>
    </parent>
  </parents>
  <author>
    <name>Marcel Molina</name>
    <email>marcel@marcelmolina.com</email>
  </author>
  <url>http://github.com/marcel/aws-s3/commit/0bc5391734300411be9e94604fafee6def13b5d1</url>
  <id>0bc5391734300411be9e94604fafee6def13b5d1</id>
  <committed-date>2008-06-06T22:23:47-07:00</committed-date>
  <authored-date>2008-06-06T22:23:47-07:00</authored-date>
  <message>Normalize the :expires_in option to always be an integer even if the actual object passed in is a proxy to an integer, such as is the case with 2.hours from ActiveSupport which is actually an instance of ActiveSupport::Duration.</message>
  <tree>a294e656a3672bcf0f4b8ff98e64975f6a2183dc</tree>
  <committer>
    <name>Marcel Molina</name>
    <email>marcel@marcelmolina.com</email>
  </committer>
</commit>
