diff options
author | Leon Breedt <bitserf@gmail.com> | 2005-11-09 05:29:08 +0000 |
---|---|---|
committer | Leon Breedt <bitserf@gmail.com> | 2005-11-09 05:29:08 +0000 |
commit | 98ae24b9676fb4c28d25c13ace8d08ec741aad04 (patch) | |
tree | 4d8f209ea0cd71b02f70b0f5d03f757e2b7816a8 /actionwebservice/lib/action_web_service | |
parent | 0abaf3a2d8d35481a5d4ddb9817d9903c8e61200 (diff) | |
download | rails-98ae24b9676fb4c28d25c13ace8d08ec741aad04.tar.gz rails-98ae24b9676fb4c28d25c13ace8d08ec741aad04.tar.bz2 rails-98ae24b9676fb4c28d25c13ace8d08ec741aad04.zip |
Fix that XML-RPC date/time values did not have well-defined behaviour (#2516, #2534). This fix has one caveat, in that we can't support pre-1970 dates from XML-RPC clients.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2945 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionwebservice/lib/action_web_service')
-rw-r--r-- | actionwebservice/lib/action_web_service/casting.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/actionwebservice/lib/action_web_service/casting.rb b/actionwebservice/lib/action_web_service/casting.rb index c9982f13a0..3c0afbe9f9 100644 --- a/actionwebservice/lib/action_web_service/casting.rb +++ b/actionwebservice/lib/action_web_service/casting.rb @@ -1,5 +1,6 @@ require 'time' require 'date' +require 'xmlrpc/datetime' module ActionWebService # :nodoc: module Casting # :nodoc: @@ -58,6 +59,13 @@ module ActionWebService # :nodoc: end def cast_base_type(value, signature_type) # :nodoc: + # This is a work-around for the fact that XML-RPC special-cases DateTime values into its own DateTime type + # in order to support iso8601 dates. This doesn't work too well for us, so we'll convert it into a Time, + # with the caveat that we won't be able to handle pre-1970 dates that are sent to us. + # + # See http://dev.rubyonrails.com/ticket/2516 + value = value.to_time if value.is_a?(XMLRPC::DateTime) + case signature_type.type when :int Integer(value) |