Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
afe6e059
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
afe6e059
编写于
12月 28, 2011
作者:
A
Aaron Patterson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4207 from nashby/deprecate-base64-encode64s
deprecate Base64.encode64s from AS
上级
c8dcc19c
a19d0f5a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
15 addition
and
9 deletion
+15
-9
actionpack/lib/action_controller/metal/http_authentication.rb
...onpack/lib/action_controller/metal/http_authentication.rb
+2
-2
activesupport/lib/active_support/base64.rb
activesupport/lib/active_support/base64.rb
+5
-1
activesupport/lib/active_support/message_encryptor.rb
activesupport/lib/active_support/message_encryptor.rb
+1
-1
activesupport/lib/active_support/message_verifier.rb
activesupport/lib/active_support/message_verifier.rb
+2
-2
activesupport/test/core_ext/base64_ext_test.rb
activesupport/test/core_ext/base64_ext_test.rb
+4
-2
activesupport/test/message_encryptor_test.rb
activesupport/test/message_encryptor_test.rb
+1
-1
未找到文件。
actionpack/lib/action_controller/metal/http_authentication.rb
浏览文件 @
afe6e059
...
...
@@ -145,7 +145,7 @@ def decode_credentials(request)
end
def
encode_credentials
(
user_name
,
password
)
"Basic
#{
ActiveSupport
::
Base64
.
encode64s
(
"
#{
user_name
}
:
#{
password
}
"
)
}
"
"Basic
#{
ActiveSupport
::
Base64
.
strict_encode64
(
"
#{
user_name
}
:
#{
password
}
"
)
}
"
end
def
authentication_request
(
controller
,
realm
)
...
...
@@ -289,7 +289,7 @@ def nonce(secret_key, time = Time.now)
t
=
time
.
to_i
hashed
=
[
t
,
secret_key
]
digest
=
::
Digest
::
MD5
.
hexdigest
(
hashed
.
join
(
":"
))
ActiveSupport
::
Base64
.
encode64
(
"
#{
t
}
:
#{
digest
}
"
).
gsub
(
"
\n
"
,
''
)
ActiveSupport
::
Base64
.
strict_encode64
(
"
#{
t
}
:
#{
digest
}
"
)
end
# Might want a shorter timeout depending on whether the request
...
...
activesupport/lib/active_support/base64.rb
浏览文件 @
afe6e059
...
...
@@ -3,12 +3,16 @@
module
ActiveSupport
Base64
=
::
Base64
# *DEPRECATED*: Use +Base64.strict_encode64+ instead.
#
# Encodes the value as base64 without the newline breaks. This makes the base64 encoding readily usable as URL parameters
# or memcache keys without further processing.
#
# ActiveSupport::Base64.encode64s("Original unencoded string")
# # => "T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw=="
def
Base64
.
encode64s
(
value
)
encode64
(
value
).
gsub
(
/\n/
,
''
)
ActiveSupport
::
Deprecation
.
warn
"encode64s "
\
"is deprecated. Use Base64.strict_encode64 instead"
,
caller
strict_encode64
(
value
)
end
end
activesupport/lib/active_support/message_encryptor.rb
浏览文件 @
afe6e059
...
...
@@ -56,7 +56,7 @@ def _encrypt(value)
encrypted_data
=
cipher
.
update
(
@serializer
.
dump
(
value
))
encrypted_data
<<
cipher
.
final
[
encrypted_data
,
iv
].
map
{
|
v
|
ActiveSupport
::
Base64
.
encode64s
(
v
)}.
join
(
"--"
)
[
encrypted_data
,
iv
].
map
{
|
v
|
ActiveSupport
::
Base64
.
strict_encode64
(
v
)}.
join
(
"--"
)
end
def
_decrypt
(
encrypted_message
)
...
...
activesupport/lib/active_support/message_verifier.rb
浏览文件 @
afe6e059
...
...
@@ -18,7 +18,7 @@ module ActiveSupport
# self.current_user = User.find(id)
# end
#
# By default it uses Marshal to serialize the message. If you want to use another
# By default it uses Marshal to serialize the message. If you want to use another
# serialization method, you can set the serializer attribute to something that responds
# to dump and load, e.g.:
#
...
...
@@ -44,7 +44,7 @@ def verify(signed_message)
end
def
generate
(
value
)
data
=
ActiveSupport
::
Base64
.
encode64s
(
@serializer
.
dump
(
value
))
data
=
ActiveSupport
::
Base64
.
strict_encode64
(
@serializer
.
dump
(
value
))
"
#{
data
}
--
#{
generate_digest
(
data
)
}
"
end
...
...
activesupport/test/core_ext/base64_ext_test.rb
浏览文件 @
afe6e059
...
...
@@ -2,7 +2,9 @@
class
Base64Test
<
Test
::
Unit
::
TestCase
def
test_no_newline_in_encoded_value
assert_match
(
/\n/
,
ActiveSupport
::
Base64
.
encode64
(
"oneverylongstringthatwouldnormallybesplitupbynewlinesbytheregularbase64"
))
assert_no_match
(
/\n/
,
ActiveSupport
::
Base64
.
encode64s
(
"oneverylongstringthatwouldnormallybesplitupbynewlinesbytheregularbase64"
))
ActiveSupport
::
Deprecation
.
silence
do
assert_match
(
/\n/
,
ActiveSupport
::
Base64
.
encode64
(
"oneverylongstringthatwouldnormallybesplitupbynewlinesbytheregularbase64"
))
assert_no_match
(
/\n/
,
ActiveSupport
::
Base64
.
encode64s
(
"oneverylongstringthatwouldnormallybesplitupbynewlinesbytheregularbase64"
))
end
end
end
activesupport/test/message_encryptor_test.rb
浏览文件 @
afe6e059
...
...
@@ -78,7 +78,7 @@ def assert_not_verified(value)
def
munge
(
base64_string
)
bits
=
ActiveSupport
::
Base64
.
decode64
(
base64_string
)
bits
.
reverse!
ActiveSupport
::
Base64
.
encode64s
(
bits
)
ActiveSupport
::
Base64
.
strict_encode64
(
bits
)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录