Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
a5a87f52
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a5a87f52
编写于
10月 15, 2009
作者:
A
alanb
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
f818d32b
16bb6052
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
113 addition
and
0 deletion
+113
-0
jdk/src/share/classes/sun/net/httpserver/ExchangeImpl.java
jdk/src/share/classes/sun/net/httpserver/ExchangeImpl.java
+16
-0
jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
.../classes/sun/net/www/protocol/http/HttpURLConnection.java
+4
-0
jdk/test/com/sun/net/httpserver/bugs/B6886436.java
jdk/test/com/sun/net/httpserver/bugs/B6886436.java
+93
-0
未找到文件。
jdk/src/share/classes/sun/net/httpserver/ExchangeImpl.java
浏览文件 @
a5a87f52
...
@@ -31,6 +31,7 @@ import java.nio.channels.*;
...
@@ -31,6 +31,7 @@ import java.nio.channels.*;
import
java.net.*
;
import
java.net.*
;
import
javax.net.ssl.*
;
import
javax.net.ssl.*
;
import
java.util.*
;
import
java.util.*
;
import
java.util.logging.Logger
;
import
java.text.*
;
import
java.text.*
;
import
sun.net.www.MessageHeader
;
import
sun.net.www.MessageHeader
;
import
com.sun.net.httpserver.*
;
import
com.sun.net.httpserver.*
;
...
@@ -204,6 +205,21 @@ class ExchangeImpl {
...
@@ -204,6 +205,21 @@ class ExchangeImpl {
tmpout
.
write
(
bytes
(
statusLine
,
0
),
0
,
statusLine
.
length
());
tmpout
.
write
(
bytes
(
statusLine
,
0
),
0
,
statusLine
.
length
());
boolean
noContentToSend
=
false
;
// assume there is content
boolean
noContentToSend
=
false
;
// assume there is content
rspHdrs
.
set
(
"Date"
,
df
.
format
(
new
Date
()));
rspHdrs
.
set
(
"Date"
,
df
.
format
(
new
Date
()));
/* check for response type that is not allowed to send a body */
if
((
rCode
>=
100
&&
rCode
<
200
)
/* informational */
||(
rCode
==
204
)
/* no content */
||(
rCode
==
304
))
/* not modified */
{
if
(
contentLen
!=
-
1
)
{
Logger
logger
=
server
.
getLogger
();
String
msg
=
"sendResponseHeaders: rCode = "
+
rCode
+
": forcing contentLen = -1"
;
logger
.
warning
(
msg
);
}
contentLen
=
-
1
;
}
if
(
contentLen
==
0
)
{
if
(
contentLen
==
0
)
{
if
(
http10
)
{
if
(
http10
)
{
o
.
setWrappedStream
(
new
UndefLengthOutputStream
(
this
,
ros
));
o
.
setWrappedStream
(
new
UndefLengthOutputStream
(
this
,
ros
));
...
...
jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
浏览文件 @
a5a87f52
...
@@ -1180,6 +1180,10 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
...
@@ -1180,6 +1180,10 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
inputStream
=
http
.
getInputStream
();
inputStream
=
http
.
getInputStream
();
respCode
=
getResponseCode
();
respCode
=
getResponseCode
();
if
(
respCode
==
-
1
)
{
disconnectInternal
();
throw
new
IOException
(
"Invalid Http response"
);
}
if
(
respCode
==
HTTP_PROXY_AUTH
)
{
if
(
respCode
==
HTTP_PROXY_AUTH
)
{
if
(
streaming
())
{
if
(
streaming
())
{
disconnectInternal
();
disconnectInternal
();
...
...
jdk/test/com/sun/net/httpserver/bugs/B6886436.java
0 → 100644
浏览文件 @
a5a87f52
/*
* Copyright 2009 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/**
* @test
* @bug 6886436
* @summary
*/
import
com.sun.net.httpserver.*
;
import
java.util.*
;
import
java.util.concurrent.*
;
import
java.util.logging.*
;
import
java.io.*
;
import
java.net.*
;
public
class
B6886436
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Logger
logger
=
Logger
.
getLogger
(
"com.sun.net.httpserver"
);
ConsoleHandler
c
=
new
ConsoleHandler
();
c
.
setLevel
(
Level
.
WARNING
);
logger
.
addHandler
(
c
);
logger
.
setLevel
(
Level
.
WARNING
);
Handler
handler
=
new
Handler
();
InetSocketAddress
addr
=
new
InetSocketAddress
(
0
);
HttpServer
server
=
HttpServer
.
create
(
addr
,
0
);
HttpContext
ctx
=
server
.
createContext
(
"/test"
,
handler
);
ExecutorService
executor
=
Executors
.
newCachedThreadPool
();
server
.
setExecutor
(
executor
);
server
.
start
();
URL
url
=
new
URL
(
"http://localhost:"
+
server
.
getAddress
().
getPort
()+
"/test/foo.html"
);
HttpURLConnection
urlc
=
(
HttpURLConnection
)
url
.
openConnection
();
try
{
InputStream
is
=
urlc
.
getInputStream
();
while
(
is
.
read
()!=
-
1
)
;
is
.
close
();
urlc
=
(
HttpURLConnection
)
url
.
openConnection
();
urlc
.
setReadTimeout
(
3000
);
is
=
urlc
.
getInputStream
();
while
(
is
.
read
()!=
-
1
);
is
.
close
();
}
catch
(
IOException
e
)
{
server
.
stop
(
2
);
executor
.
shutdown
();
throw
new
RuntimeException
(
"Test failed"
);
}
server
.
stop
(
2
);
executor
.
shutdown
();
System
.
out
.
println
(
"OK"
);
}
public
static
boolean
error
=
false
;
static
class
Handler
implements
HttpHandler
{
int
invocation
=
1
;
public
void
handle
(
HttpExchange
t
)
throws
IOException
{
InputStream
is
=
t
.
getRequestBody
();
Headers
map
=
t
.
getRequestHeaders
();
Headers
rmap
=
t
.
getResponseHeaders
();
while
(
is
.
read
()
!=
-
1
)
;
is
.
close
();
// send a 204 response with an empty chunked body
t
.
sendResponseHeaders
(
204
,
0
);
t
.
close
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录