Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
5ade0ddf
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,发现更多精彩内容 >>
提交
5ade0ddf
编写于
7月 05, 2013
作者:
S
Steve Klabnik
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11131 from ykzts/fix/actiondispatch-ssl-not-required-space
Space is not required for Set-Cookie header
上级
19f842b5
ce89251b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
1 deletion
+34
-1
actionpack/CHANGELOG.md
actionpack/CHANGELOG.md
+4
-0
actionpack/lib/action_dispatch/middleware/ssl.rb
actionpack/lib/action_dispatch/middleware/ssl.rb
+1
-1
actionpack/test/dispatch/ssl_test.rb
actionpack/test/dispatch/ssl_test.rb
+29
-0
未找到文件。
actionpack/CHANGELOG.md
浏览文件 @
5ade0ddf
*
Ignore spaces around delimiter in Set-Cookie header.
*Yamagishi Kazutoshi*
*
Remove deprecated Rails application fallback for integration testing, set
`ActionDispatch.test_app`
instead.
...
...
actionpack/lib/action_dispatch/middleware/ssl.rb
浏览文件 @
5ade0ddf
...
...
@@ -57,7 +57,7 @@ def flag_cookies_as_secure!(headers)
cookies
=
cookies
.
split
(
"
\n
"
)
headers
[
'Set-Cookie'
]
=
cookies
.
map
{
|
cookie
|
if
cookie
!~
/;\s
+secure
(;|$)/i
if
cookie
!~
/;\s
*secure\s*
(;|$)/i
"
#{
cookie
}
; secure"
else
cookie
...
...
actionpack/test/dispatch/ssl_test.rb
浏览文件 @
5ade0ddf
...
...
@@ -124,6 +124,35 @@ def test_flag_cookies_as_secure_with_more_spaces_after
response
.
headers
[
'Set-Cookie'
].
split
(
"
\n
"
)
end
def
test_flag_cookies_as_secure_with_has_not_spaces_before
self
.
app
=
ActionDispatch
::
SSL
.
new
(
lambda
{
|
env
|
headers
=
{
'Content-Type'
=>
"text/html"
,
'Set-Cookie'
=>
"problem=def; path=/;secure; HttpOnly"
}
[
200
,
headers
,
[
"OK"
]]
})
get
"https://example.org/"
assert_equal
[
"problem=def; path=/;secure; HttpOnly"
],
response
.
headers
[
'Set-Cookie'
].
split
(
"
\n
"
)
end
def
test_flag_cookies_as_secure_with_has_not_spaces_after
self
.
app
=
ActionDispatch
::
SSL
.
new
(
lambda
{
|
env
|
headers
=
{
'Content-Type'
=>
"text/html"
,
'Set-Cookie'
=>
"problem=def; path=/; secure;HttpOnly"
}
[
200
,
headers
,
[
"OK"
]]
})
get
"https://example.org/"
assert_equal
[
"problem=def; path=/; secure;HttpOnly"
],
response
.
headers
[
'Set-Cookie'
].
split
(
"
\n
"
)
end
def
test_flag_cookies_as_secure_with_ignore_case
self
.
app
=
ActionDispatch
::
SSL
.
new
(
lambda
{
|
env
|
headers
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录