Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
9e2948e7
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,发现更多精彩内容 >>
提交
9e2948e7
编写于
9月 22, 2012
作者:
G
grosser
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
depreacte unused Mime::Type#verify_request? and Mime::Type.browser_generated_types
上级
133d42bc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
8 deletion
+24
-8
actionpack/CHANGELOG.md
actionpack/CHANGELOG.md
+5
-0
actionpack/lib/action_dispatch/http/mime_type.rb
actionpack/lib/action_dispatch/http/mime_type.rb
+6
-1
actionpack/test/dispatch/mime_type_test.rb
actionpack/test/dispatch/mime_type_test.rb
+5
-3
actionpack/test/dispatch/rack_test.rb
actionpack/test/dispatch/rack_test.rb
+8
-4
未找到文件。
actionpack/CHANGELOG.md
浏览文件 @
9e2948e7
## Rails 4.0.0 (unreleased) ##
*
Deprecate Mime::Type#verify_request? and Mime::Type.browser_generated_types,
since they are no longer used inside of Rails, they will be removed in Rails 4.1
*Michael Grosser*
*
`ActionDispatch::Http::UploadedFile`
now delegates
`close`
to its tempfile.
*Sergio Gil*
*
Add
`ActionController::StrongParameters`
, this module converts
`params`
hash into
...
...
actionpack/lib/action_dispatch/http/mime_type.rb
浏览文件 @
9e2948e7
...
...
@@ -57,7 +57,6 @@ class Type
# i.e. following a link, getting an image or posting a form. CSRF protection
# only needs to protect against these types.
@@browser_generated_types
=
Set
.
new
[
:html
,
:url_encoded_form
,
:multipart_form
,
:text
]
cattr_reader
:browser_generated_types
attr_reader
:symbol
@register_callbacks
=
[]
...
...
@@ -276,9 +275,15 @@ def =~(mime_type)
# Returns true if Action Pack should check requests using this Mime Type for possible request forgery. See
# ActionController::RequestForgeryProtection.
def
verify_request?
ActiveSupport
::
Deprecation
.
warn
"Mime::Type#verify_request? is deprecated and will be removed in Rails 4.1"
@@browser_generated_types
.
include?
(
to_sym
)
end
def
self
.
browser_generated_types
ActiveSupport
::
Deprecation
.
warn
"Mime::Type.browser_generated_types is deprecated and will be removed in Rails 4.1"
@@browser_generated_types
end
def
html?
@@html_types
.
include?
(
to_sym
)
||
@string
=~
/html/
end
...
...
actionpack/test/dispatch/mime_type_test.rb
浏览文件 @
9e2948e7
...
...
@@ -185,9 +185,11 @@ class MimeTypeTest < ActiveSupport::TestCase
all_types
.
uniq!
# Remove custom Mime::Type instances set in other tests, like Mime::GIF and Mime::IPHONE
all_types
.
delete_if
{
|
type
|
!
Mime
.
const_defined?
(
type
.
upcase
)
}
verified
,
unverified
=
all_types
.
partition
{
|
type
|
Mime
::
Type
.
browser_generated_types
.
include?
type
}
assert
verified
.
each
{
|
type
|
assert
Mime
.
const_get
(
type
.
upcase
).
verify_request?
,
"Verifiable Mime Type is not verified:
#{
type
.
inspect
}
"
}
assert
unverified
.
each
{
|
type
|
assert
!
Mime
.
const_get
(
type
.
upcase
).
verify_request?
,
"Nonverifiable Mime Type is verified:
#{
type
.
inspect
}
"
}
assert_deprecated
do
verified
,
unverified
=
all_types
.
partition
{
|
type
|
Mime
::
Type
.
browser_generated_types
.
include?
type
}
assert
verified
.
each
{
|
type
|
assert
Mime
.
const_get
(
type
.
upcase
).
verify_request?
,
"Verifiable Mime Type is not verified:
#{
type
.
inspect
}
"
}
assert
unverified
.
each
{
|
type
|
assert
!
Mime
.
const_get
(
type
.
upcase
).
verify_request?
,
"Nonverifiable Mime Type is verified:
#{
type
.
inspect
}
"
}
end
end
test
"references gives preference to symbols before strings"
do
...
...
actionpack/test/dispatch/rack_test.rb
浏览文件 @
9e2948e7
...
...
@@ -176,13 +176,17 @@ class RackRequestParamsParsingTest < BaseRackTest
class
RackRequestContentTypeTest
<
BaseRackTest
test
"html content type verification"
do
@request
.
env
[
'CONTENT_TYPE'
]
=
Mime
::
HTML
.
to_s
assert
@request
.
content_mime_type
.
verify_request?
assert_deprecated
do
@request
.
env
[
'CONTENT_TYPE'
]
=
Mime
::
HTML
.
to_s
assert
@request
.
content_mime_type
.
verify_request?
end
end
test
"xml content type verification"
do
@request
.
env
[
'CONTENT_TYPE'
]
=
Mime
::
XML
.
to_s
assert
!
@request
.
content_mime_type
.
verify_request?
assert_deprecated
do
@request
.
env
[
'CONTENT_TYPE'
]
=
Mime
::
XML
.
to_s
assert
!
@request
.
content_mime_type
.
verify_request?
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录