aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/http_authentication.rb6
-rw-r--r--actionpack/lib/action_controller/session/active_record_store.rb15
-rw-r--r--actionpack/lib/action_controller/session/cookie_store.rb5
-rw-r--r--actionpack/test/activerecord/active_record_store_test.rb2
-rw-r--r--actionpack/test/controller/request_test.rb6
5 files changed, 15 insertions, 19 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
diff --git a/actionpack/test/activerecord/active_record_store_test.rb b/actionpack/test/activerecord/active_record_store_test.rb
index 707a0a75cc..61900ac252 100644
--- a/actionpack/test/activerecord/active_record_store_test.rb
+++ b/actionpack/test/activerecord/active_record_store_test.rb
@@ -66,7 +66,7 @@ class ActiveRecordStoreTest < ActiveRecordTestCase
def test_save_unloaded_session
c = session_class.connection
- bogus_class = c.quote(Base64.encode64("\004\010o:\vBlammo\000"))
+ bogus_class = c.quote(ActiveSupport::Base64.encode64("\004\010o:\vBlammo\000"))
c.insert("INSERT INTO #{session_class.table_name} ('#{session_id_column}', 'data') VALUES ('abcdefghijklmnop', #{bogus_class})")
sess = session_class.find_by_session_id('abcdefghijklmnop')
diff --git a/actionpack/test/controller/request_test.rb b/actionpack/test/controller/request_test.rb
index 698d3cbd2a..a81fa4d866 100644
--- a/actionpack/test/controller/request_test.rb
+++ b/actionpack/test/controller/request_test.rb
@@ -789,7 +789,7 @@ end
class XmlParamsParsingTest < Test::Unit::TestCase
def test_single_file
- person = parse_body("<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{Base64.encode64('ABC')}</avatar></person>")
+ person = parse_body("<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar></person>")
assert_equal "image/jpg", person['person']['avatar'].content_type
assert_equal "me.jpg", person['person']['avatar'].original_filename
@@ -801,8 +801,8 @@ class XmlParamsParsingTest < Test::Unit::TestCase
<person>
<name>David</name>
<avatars>
- <avatar type='file' name='me.jpg' content_type='image/jpg'>#{Base64.encode64('ABC')}</avatar>
- <avatar type='file' name='you.gif' content_type='image/gif'>#{Base64.encode64('DEF')}</avatar>
+ <avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar>
+ <avatar type='file' name='you.gif' content_type='image/gif'>#{ActiveSupport::Base64.encode64('DEF')}</avatar>
</avatars>
</person>
end_body