diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-18 21:14:07 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-18 21:14:07 +0000 |
commit | f91acf0258b3d40cbb31663e965669b7199be051 (patch) | |
tree | a5a1caabd8c681b459360d92b7b62bf665c9a1eb /actionpack/lib | |
parent | 2bdac92dcf8caf9e2b45796f8af56da6a293d722 (diff) | |
download | rails-f91acf0258b3d40cbb31663e965669b7199be051.tar.gz rails-f91acf0258b3d40cbb31663e965669b7199be051.tar.bz2 rails-f91acf0258b3d40cbb31663e965669b7199be051.zip |
Ruby 1.9 compat: move from the deprecated Base64 module to ActiveSupport::Base64. Closes #10554.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8433 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
3 files changed, 11 insertions, 15 deletions
diff --git a/actionpack/lib/action_controller/http_authentication.rb b/actionpack/lib/action_controller/http_authentication.rb index 18a503c3ad..cd81c24e8b 100644 --- a/actionpack/lib/action_controller/http_authentication.rb +++ b/actionpack/lib/action_controller/http_authentication.rb @@ -1,5 +1,3 @@ -require 'base64' - module ActionController module HttpAuthentication # Makes it dead easy to do HTTP Basic authentication. @@ -110,11 +108,11 @@ module ActionController end def decode_credentials(request) - Base64.decode64(authorization(request).split.last || '') + ActiveSupport::Base64.decode64(authorization(request).split.last || '') end def encode_credentials(user_name, password) - "Basic #{Base64.encode64("#{user_name}:#{password}")}" + "Basic #{ActiveSupport::Base64.encode64("#{user_name}:#{password}")}" end def authentication_request(controller, realm) diff --git a/actionpack/lib/action_controller/session/active_record_store.rb b/actionpack/lib/action_controller/session/active_record_store.rb index 14747c5052..379fcd62b6 100644 --- a/actionpack/lib/action_controller/session/active_record_store.rb +++ b/actionpack/lib/action_controller/session/active_record_store.rb @@ -1,7 +1,6 @@ require 'cgi' require 'cgi/session' require 'digest/md5' -require 'base64' class CGI class Session @@ -80,8 +79,8 @@ class CGI find_by_session_id(session_id) end - def marshal(data) Base64.encode64(Marshal.dump(data)) if data end - def unmarshal(data) Marshal.load(Base64.decode64(data)) if data end + def marshal(data) ActiveSupport::Base64.encode64(Marshal.dump(data)) if data end + def unmarshal(data) Marshal.load(ActiveSupport::Base64.decode64(data)) if data end def create_table! connection.execute <<-end_sql @@ -155,8 +154,8 @@ class CGI # The database connection, table name, and session id and data columns # are configurable class attributes. Marshaling and unmarshaling # are implemented as class methods that you may override. By default, - # marshaling data is +Base64.encode64(Marshal.dump(data))+ and - # unmarshaling data is +Marshal.load(Base64.decode64(data))+. + # marshaling data is +ActiveSupport::Base64.encode64(Marshal.dump(data))+ and + # unmarshaling data is +Marshal.load(ActiveSupport::Base64.decode64(data))+. # # This marshaling behavior is intended to store the widest range of # binary session data in a +text+ column. For higher performance, @@ -190,8 +189,8 @@ class CGI end end - def marshal(data) Base64.encode64(Marshal.dump(data)) if data end - def unmarshal(data) Marshal.load(Base64.decode64(data)) if data end + def marshal(data) ActiveSupport::Base64.encode64(Marshal.dump(data)) if data end + def unmarshal(data) Marshal.load(ActiveSupport::Base64.decode64(data)) if data end def create_table! @@connection.execute <<-end_sql @@ -333,4 +332,4 @@ class CGI end end end -end
\ No newline at end of file +end diff --git a/actionpack/lib/action_controller/session/cookie_store.rb b/actionpack/lib/action_controller/session/cookie_store.rb index 086f5a87a2..0a2a91f01e 100644 --- a/actionpack/lib/action_controller/session/cookie_store.rb +++ b/actionpack/lib/action_controller/session/cookie_store.rb @@ -1,6 +1,5 @@ require 'cgi' require 'cgi/session' -require 'base64' # to convert Marshal.dump to ASCII require 'openssl' # to generate the HMAC message digest # This cookie-based session store is the Rails default. Sessions typically @@ -130,7 +129,7 @@ class CGI::Session::CookieStore private # Marshal a session hash into safe cookie data. Include an integrity hash. def marshal(session) - data = Base64.encode64(Marshal.dump(session)).chop + data = ActiveSupport::Base64.encode64(Marshal.dump(session)).chop CGI.escape "#{data}--#{generate_digest(data)}" end @@ -142,7 +141,7 @@ class CGI::Session::CookieStore delete raise TamperedWithCookie end - Marshal.load(Base64.decode64(data)) + Marshal.load(ActiveSupport::Base64.decode64(data)) end end |