Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
3bccd123
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,发现更多精彩内容 >>
提交
3bccd123
编写于
1月 28, 2013
作者:
G
Guillermo Iguaran
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove BestStandardsSupport middleware
上级
88e4ec6e
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
3 addition
and
108 deletion
+3
-108
actionpack/lib/action_dispatch.rb
actionpack/lib/action_dispatch.rb
+0
-1
actionpack/lib/action_dispatch/middleware/best_standards_support.rb
.../lib/action_dispatch/middleware/best_standards_support.rb
+0
-30
actionpack/lib/action_dispatch/railtie.rb
actionpack/lib/action_dispatch/railtie.rb
+0
-1
actionpack/test/dispatch/best_standards_support_test.rb
actionpack/test/dispatch/best_standards_support_test.rb
+0
-35
railties/lib/rails/application.rb
railties/lib/rails/application.rb
+0
-4
railties/lib/rails/configuration.rb
railties/lib/rails/configuration.rb
+2
-2
railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
...rails/app/templates/config/environments/development.rb.tt
+0
-3
railties/test/application/middleware/best_practices_test.rb
railties/test/application/middleware/best_practices_test.rb
+0
-30
railties/test/application/middleware_test.rb
railties/test/application/middleware_test.rb
+1
-2
未找到文件。
actionpack/lib/action_dispatch.rb
浏览文件 @
3bccd123
...
...
@@ -47,7 +47,6 @@ class IllegalStateError < StandardError
autoload_under
'middleware'
do
autoload
:RequestId
autoload
:BestStandardsSupport
autoload
:Callbacks
autoload
:Cookies
autoload
:DebugExceptions
...
...
actionpack/lib/action_dispatch/middleware/best_standards_support.rb
已删除
100644 → 0
浏览文件 @
88e4ec6e
module
ActionDispatch
class
BestStandardsSupport
def
initialize
(
app
,
type
=
true
)
@app
=
app
@header
=
case
type
when
true
"IE=Edge,chrome=1"
when
:builtin
"IE=Edge"
when
false
nil
end
end
def
call
(
env
)
status
,
headers
,
body
=
@app
.
call
(
env
)
if
headers
[
"X-UA-Compatible"
]
&&
@header
unless
headers
[
"X-UA-Compatible"
][
@header
]
headers
[
"X-UA-Compatible"
]
<<
","
<<
@header
.
to_s
end
else
headers
[
"X-UA-Compatible"
]
=
@header
end
[
status
,
headers
,
body
]
end
end
end
actionpack/lib/action_dispatch/railtie.rb
浏览文件 @
3bccd123
...
...
@@ -6,7 +6,6 @@ class Railtie < Rails::Railtie # :nodoc:
config
.
action_dispatch
.
x_sendfile_header
=
nil
config
.
action_dispatch
.
ip_spoofing_check
=
true
config
.
action_dispatch
.
show_exceptions
=
true
config
.
action_dispatch
.
best_standards_support
=
true
config
.
action_dispatch
.
tld_length
=
1
config
.
action_dispatch
.
ignore_accept_header
=
false
config
.
action_dispatch
.
rescue_templates
=
{
}
...
...
actionpack/test/dispatch/best_standards_support_test.rb
已删除
100644 → 0
浏览文件 @
88e4ec6e
require
'abstract_unit'
class
BestStandardsSupportTest
<
ActiveSupport
::
TestCase
def
test_with_best_standards_support
_
,
headers
,
_
=
app
(
true
,
{}).
call
({})
assert_equal
"IE=Edge,chrome=1"
,
headers
[
"X-UA-Compatible"
]
end
def
test_with_builtin_best_standards_support
_
,
headers
,
_
=
app
(
:builtin
,
{}).
call
({})
assert_equal
"IE=Edge"
,
headers
[
"X-UA-Compatible"
]
end
def
test_without_best_standards_support
_
,
headers
,
_
=
app
(
false
,
{}).
call
({})
assert_equal
nil
,
headers
[
"X-UA-Compatible"
]
end
def
test_appends_to_app_headers_without_duplication_after_multiple_requests
app_headers
=
{
"X-UA-Compatible"
=>
"requiresActiveX=true"
}
_
,
headers
,
_
=
app
(
true
,
app_headers
).
call
({})
_
,
headers
,
_
=
app
(
true
,
app_headers
).
call
({})
expects
=
"requiresActiveX=true,IE=Edge,chrome=1"
assert_equal
expects
,
headers
[
"X-UA-Compatible"
]
end
private
def
app
(
type
,
headers
)
app
=
proc
{
[
200
,
headers
,
"response"
]
}
ActionDispatch
::
BestStandardsSupport
.
new
(
app
,
type
)
end
end
railties/lib/rails/application.rb
浏览文件 @
3bccd123
...
...
@@ -365,10 +365,6 @@ def default_middleware_stack #:nodoc:
middleware
.
use
::
Rack
::
Head
middleware
.
use
::
Rack
::
ConditionalGet
middleware
.
use
::
Rack
::
ETag
,
"no-cache"
if
config
.
action_dispatch
.
best_standards_support
middleware
.
use
::
ActionDispatch
::
BestStandardsSupport
,
config
.
action_dispatch
.
best_standards_support
end
end
end
...
...
railties/lib/rails/configuration.rb
浏览文件 @
3bccd123
...
...
@@ -27,11 +27,11 @@ module Configuration
#
# Middlewares can also be completely swapped out and replaced with others:
#
# config.middleware.swap ActionDispatch::
BestStandardsSupport
, Magical::Unicorns
# config.middleware.swap ActionDispatch::
Flash
, Magical::Unicorns
#
# And finally they can also be removed from the stack completely:
#
# config.middleware.delete ActionDispatch::
BestStandardsSupport
# config.middleware.delete ActionDispatch::
Flash
#
class
MiddlewareStackProxy
def
initialize
...
...
railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
浏览文件 @
3bccd123
...
...
@@ -19,9 +19,6 @@
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Only use best-standards-support built into browsers.
config.action_dispatch.best_standards_support = :builtin
<%- unless options.skip_active_record? -%>
# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL).
...
...
railties/test/application/middleware/best_practices_test.rb
已删除
100644 → 0
浏览文件 @
88e4ec6e
require
'isolation/abstract_unit'
module
ApplicationTests
class
BestPracticesTest
<
ActiveSupport
::
TestCase
include
ActiveSupport
::
Testing
::
Isolation
def
setup
build_app
boot_rails
require
'rack/test'
extend
Rack
::
Test
::
Methods
simple_controller
end
def
teardown
teardown_app
end
test
"simple controller in production mode returns best standards"
do
get
'/foo'
assert_equal
"IE=Edge,chrome=1"
,
last_response
.
headers
[
"X-UA-Compatible"
]
end
test
"simple controller in development mode leaves out Chrome"
do
app
(
"development"
)
get
"/foo"
assert_equal
"IE=Edge"
,
last_response
.
headers
[
"X-UA-Compatible"
]
end
end
end
railties/test/application/middleware_test.rb
浏览文件 @
3bccd123
...
...
@@ -45,8 +45,7 @@ def app
"ActionDispatch::ParamsParser"
,
"Rack::Head"
,
"Rack::ConditionalGet"
,
"Rack::ETag"
,
"ActionDispatch::BestStandardsSupport"
"Rack::ETag"
],
middleware
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录