Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1e39ea35
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看板
提交
1e39ea35
编写于
11月 14, 2014
作者:
I
igerasim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8050983: Misplaced parentheses in sun.net.www.http.HttpClient break HTTP PUT streaming
Reviewed-by: michaelm
上级
68ed55d6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
11 deletion
+22
-11
src/share/classes/sun/net/www/http/HttpClient.java
src/share/classes/sun/net/www/http/HttpClient.java
+8
-6
test/sun/net/www/http/HttpClient/StreamingRetry.java
test/sun/net/www/http/HttpClient/StreamingRetry.java
+14
-5
未找到文件。
src/share/classes/sun/net/www/http/HttpClient.java
浏览文件 @
1e39ea35
...
@@ -657,9 +657,10 @@ public class HttpClient extends NetworkClient {
...
@@ -657,9 +657,10 @@ public class HttpClient extends NetworkClient {
cachedHttpClient
=
false
;
cachedHttpClient
=
false
;
if
(!
failedOnce
&&
requests
!=
null
)
{
if
(!
failedOnce
&&
requests
!=
null
)
{
failedOnce
=
true
;
failedOnce
=
true
;
if
(
getRequestMethod
().
equals
(
"CONNECT"
)
||
if
(
getRequestMethod
().
equals
(
"CONNECT"
)
(
httpuc
.
getRequestMethod
().
equals
(
"POST"
)
&&
||
streaming
(!
retryPostProp
||
streaming
)))
{
||
(
httpuc
.
getRequestMethod
().
equals
(
"POST"
)
&&
!
retryPostProp
))
{
// do not retry the request
// do not retry the request
}
else
{
}
else
{
// try once more
// try once more
...
@@ -769,9 +770,10 @@ public class HttpClient extends NetworkClient {
...
@@ -769,9 +770,10 @@ public class HttpClient extends NetworkClient {
}
else
if
(
nread
!=
8
)
{
}
else
if
(
nread
!=
8
)
{
if
(!
failedOnce
&&
requests
!=
null
)
{
if
(!
failedOnce
&&
requests
!=
null
)
{
failedOnce
=
true
;
failedOnce
=
true
;
if
(
getRequestMethod
().
equals
(
"CONNECT"
)
||
if
(
getRequestMethod
().
equals
(
"CONNECT"
)
(
httpuc
.
getRequestMethod
().
equals
(
"POST"
)
&&
||
streaming
(!
retryPostProp
||
streaming
)))
{
||
(
httpuc
.
getRequestMethod
().
equals
(
"POST"
)
&&
!
retryPostProp
))
{
// do not retry the request
// do not retry the request
}
else
{
}
else
{
closeServer
();
closeServer
();
...
...
test/sun/net/www/http/HttpClient/StreamingRetry.java
浏览文件 @
1e39ea35
...
@@ -23,8 +23,8 @@
...
@@ -23,8 +23,8 @@
/*
/*
* @test
* @test
* @bug 6672144
* @bug 6672144
8050983
* @summary
HttpURLConnection.getInputStream sends POST request after failed chunked send
* @summary
Do not retry failed request with a streaming body.
*/
*/
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
...
@@ -33,6 +33,7 @@ import java.net.URL;
...
@@ -33,6 +33,7 @@ import java.net.URL;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
static
java
.
lang
.
System
.
out
;
public
class
StreamingRetry
implements
Runnable
{
public
class
StreamingRetry
implements
Runnable
{
static
final
int
ACCEPT_TIMEOUT
=
20
*
1000
;
// 20 seconds
static
final
int
ACCEPT_TIMEOUT
=
20
*
1000
;
// 20 seconds
...
@@ -43,11 +44,17 @@ public class StreamingRetry implements Runnable {
...
@@ -43,11 +44,17 @@ public class StreamingRetry implements Runnable {
}
}
void
instanceMain
()
throws
IOException
{
void
instanceMain
()
throws
IOException
{
test
();
out
.
println
(
"Test with default method"
);
test
(
null
);
out
.
println
(
"Test with POST method"
);
test
(
"POST"
);
out
.
println
(
"Test with PUT method"
);
test
(
"PUT"
);
if
(
failed
>
0
)
throw
new
RuntimeException
(
"Some tests failed"
);
if
(
failed
>
0
)
throw
new
RuntimeException
(
"Some tests failed"
);
}
}
void
test
()
throws
IOException
{
void
test
(
String
method
)
throws
IOException
{
ss
=
new
ServerSocket
(
0
);
ss
=
new
ServerSocket
(
0
);
ss
.
setSoTimeout
(
ACCEPT_TIMEOUT
);
ss
.
setSoTimeout
(
ACCEPT_TIMEOUT
);
int
port
=
ss
.
getLocalPort
();
int
port
=
ss
.
getLocalPort
();
...
@@ -58,6 +65,8 @@ public class StreamingRetry implements Runnable {
...
@@ -58,6 +65,8 @@ public class StreamingRetry implements Runnable {
URL
url
=
new
URL
(
"http://localhost:"
+
port
+
"/"
);
URL
url
=
new
URL
(
"http://localhost:"
+
port
+
"/"
);
HttpURLConnection
uc
=
(
HttpURLConnection
)
url
.
openConnection
();
HttpURLConnection
uc
=
(
HttpURLConnection
)
url
.
openConnection
();
uc
.
setDoOutput
(
true
);
uc
.
setDoOutput
(
true
);
if
(
method
!=
null
)
uc
.
setRequestMethod
(
method
);
uc
.
setChunkedStreamingMode
(
4096
);
uc
.
setChunkedStreamingMode
(
4096
);
OutputStream
os
=
uc
.
getOutputStream
();
OutputStream
os
=
uc
.
getOutputStream
();
os
.
write
(
"Hello there"
.
getBytes
());
os
.
write
(
"Hello there"
.
getBytes
());
...
@@ -79,7 +88,7 @@ public class StreamingRetry implements Runnable {
...
@@ -79,7 +88,7 @@ public class StreamingRetry implements Runnable {
ss
.
close
();
ss
.
close
();
fail
(
"The server shouldn't accept a second connection"
);
fail
(
"The server shouldn't accept a second connection"
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
//OK, the clien
will close the server socket if successful
l
//OK, the clien
t will close the server socket if successfu
l
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录