Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
2e3f6411
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2e3f6411
编写于
2月 19, 2013
作者:
C
coffeys
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8007315: HttpURLConnection.filterHeaderField method returns null where empty string is expected
Reviewed-by: chegar
上级
34aeb550
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
4 deletion
+36
-4
src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
.../classes/sun/net/www/protocol/http/HttpURLConnection.java
+2
-2
test/sun/net/www/protocol/http/HttpOnly.java
test/sun/net/www/protocol/http/HttpOnly.java
+34
-2
未找到文件。
src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
浏览文件 @
2e3f6411
/*
* Copyright (c) 1995, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 201
3
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -2637,7 +2637,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
multipleCookies
=
true
;
}
return
retValue
.
length
()
==
0
?
null
:
retValue
.
toString
();
return
retValue
.
length
()
==
0
?
""
:
retValue
.
toString
();
}
return
value
;
...
...
test/sun/net/www/protocol/http/HttpOnly.java
浏览文件 @
2e3f6411
/*
* Copyright (c) 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 201
2, 2013
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -22,7 +22,7 @@
*/
/**
* @test
* @bug 7095980
* @bug 7095980
8007315
* @summary Ensure HttpURLConnection (and supporting APIs) don't expose
* HttpOnly cookies
*/
...
...
@@ -52,6 +52,8 @@ import com.sun.net.httpserver.HttpServer;
* 4) check HttpOnly cookies received by server
* 5) server reply with Set-Cookie containing HttpOnly cookie
* 6) check HttpOnly cookies are not accessible from Http client
* 7) check that non-null (empty string) values are returned for
scenario where all values are stripped from original key values
*/
public
class
HttpOnly
{
...
...
@@ -177,6 +179,36 @@ public class HttpOnly {
" value "
+
val
);
}
}
// TEST 7 : check that header keys containing empty key values don't return null
int
i
=
1
;
String
key
=
""
;
String
value
=
""
;
while
(
true
)
{
key
=
uc
.
getHeaderFieldKey
(
i
);
value
=
uc
.
getHeaderField
(
i
++);
if
(
key
==
null
&&
value
==
null
)
break
;
if
(
key
!=
null
)
check
(
value
!=
null
,
"Encountered a null value for key value : "
+
key
);
}
// TEST 7.5 similar test but use getHeaderFields
respHeaders
=
uc
.
getHeaderFields
();
respEntries
=
respHeaders
.
entrySet
();
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
respEntries
)
{
String
header
=
entry
.
getKey
();
if
(
header
!=
null
)
{
List
<
String
>
listValues
=
entry
.
getValue
();
for
(
String
value1
:
listValues
)
check
(
value1
!=
null
,
"getHeaderFields returned null values for header:, "
+
header
);
}
}
}
// HTTP Server
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录