Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
cd8d5ed5
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看板
提交
cd8d5ed5
编写于
3月 21, 2013
作者:
R
robm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8009251: Add proxy handling and keep-alive fixes to jsse
Reviewed-by: chegar
上级
13c3a340
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
73 addition
and
19 deletion
+73
-19
src/share/classes/sun/net/www/http/HttpClient.java
src/share/classes/sun/net/www/http/HttpClient.java
+1
-1
src/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
...ww/protocol/https/AbstractDelegateHttpsURLConnection.java
+5
-4
src/share/classes/sun/net/www/protocol/https/HttpsClient.java
...share/classes/sun/net/www/protocol/https/HttpsClient.java
+67
-14
未找到文件。
src/share/classes/sun/net/www/http/HttpClient.java
浏览文件 @
cd8d5ed5
...
...
@@ -46,7 +46,7 @@ public class HttpClient extends NetworkClient {
// whether this httpclient comes from the cache
protected
boolean
cachedHttpClient
=
false
;
pr
ivate
boolean
inCache
;
pr
otected
boolean
inCache
;
// Http requests we send
MessageHeader
requests
;
...
...
src/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java
浏览文件 @
cd8d5ed5
...
...
@@ -96,7 +96,7 @@ public abstract class AbstractDelegateHttpsURLConnection extends
http
=
HttpsClient
.
New
(
getSSLSocketFactory
(),
url
,
getHostnameVerifier
(),
useCache
);
useCache
,
this
);
((
HttpsClient
)
http
).
afterConnect
();
}
...
...
@@ -149,7 +149,7 @@ public abstract class AbstractDelegateHttpsURLConnection extends
http
=
HttpsClient
.
New
(
getSSLSocketFactory
(),
url
,
getHostnameVerifier
(),
proxyHost
,
proxyPort
,
useCache
);
proxyHost
,
proxyPort
,
useCache
,
this
);
connected
=
true
;
}
...
...
@@ -189,7 +189,8 @@ public abstract class AbstractDelegateHttpsURLConnection extends
protected
HttpClient
getNewHttpClient
(
URL
url
,
Proxy
p
,
int
connectTimeout
)
throws
IOException
{
return
HttpsClient
.
New
(
getSSLSocketFactory
(),
url
,
getHostnameVerifier
(),
p
,
true
,
connectTimeout
);
getHostnameVerifier
(),
p
,
true
,
connectTimeout
,
this
);
}
// will open new connection
...
...
@@ -198,7 +199,7 @@ public abstract class AbstractDelegateHttpsURLConnection extends
throws
IOException
{
return
HttpsClient
.
New
(
getSSLSocketFactory
(),
url
,
getHostnameVerifier
(),
p
,
useCache
,
connectTimeout
);
useCache
,
connectTimeout
,
this
);
}
/**
...
...
src/share/classes/sun/net/www/protocol/https/HttpsClient.java
浏览文件 @
cd8d5ed5
...
...
@@ -30,6 +30,7 @@ import java.io.IOException;
import
java.io.UnsupportedEncodingException
;
import
java.io.PrintStream
;
import
java.io.BufferedOutputStream
;
import
java.net.InetAddress
;
import
java.net.Socket
;
import
java.net.SocketException
;
import
java.net.URL
;
...
...
@@ -46,11 +47,15 @@ import javax.security.auth.x500.X500Principal;
import
javax.net.ssl.*
;
import
sun.net.www.http.HttpClient
;
import
sun.net.www.protocol.http.HttpURLConnection
;
import
sun.security.action.*
;
import
sun.security.util.HostnameChecker
;
import
sun.security.ssl.SSLSocketImpl
;
import
sun.util.logging.PlatformLogger
;
import
static
sun
.
net
.
www
.
protocol
.
http
.
HttpURLConnection
.
TunnelState
.*;
/**
* This class provides HTTPS client URL support, building on the standard
...
...
@@ -274,15 +279,17 @@ final class HttpsClient extends HttpClient
// This code largely ripped off from HttpClient.New, and
// it uses the same keepalive cache.
static
HttpClient
New
(
SSLSocketFactory
sf
,
URL
url
,
HostnameVerifier
hv
)
static
HttpClient
New
(
SSLSocketFactory
sf
,
URL
url
,
HostnameVerifier
hv
,
HttpURLConnection
httpuc
)
throws
IOException
{
return
HttpsClient
.
New
(
sf
,
url
,
hv
,
true
);
return
HttpsClient
.
New
(
sf
,
url
,
hv
,
true
,
httpuc
);
}
/** See HttpClient for the model for this method. */
static
HttpClient
New
(
SSLSocketFactory
sf
,
URL
url
,
HostnameVerifier
hv
,
boolean
useCache
)
throws
IOException
{
return
HttpsClient
.
New
(
sf
,
url
,
hv
,
(
String
)
null
,
-
1
,
useCache
);
HostnameVerifier
hv
,
boolean
useCache
,
HttpURLConnection
httpuc
)
throws
IOException
{
return
HttpsClient
.
New
(
sf
,
url
,
hv
,
(
String
)
null
,
-
1
,
useCache
,
httpuc
);
}
/**
...
...
@@ -290,37 +297,74 @@ final class HttpsClient extends HttpClient
* the specified proxy server.
*/
static
HttpClient
New
(
SSLSocketFactory
sf
,
URL
url
,
HostnameVerifier
hv
,
String
proxyHost
,
int
proxyPort
)
throws
IOException
{
return
HttpsClient
.
New
(
sf
,
url
,
hv
,
proxyHost
,
proxyPort
,
true
);
String
proxyHost
,
int
proxyPort
,
HttpURLConnection
httpuc
)
throws
IOException
{
return
HttpsClient
.
New
(
sf
,
url
,
hv
,
proxyHost
,
proxyPort
,
true
,
httpuc
);
}
static
HttpClient
New
(
SSLSocketFactory
sf
,
URL
url
,
HostnameVerifier
hv
,
String
proxyHost
,
int
proxyPort
,
boolean
useCache
)
String
proxyHost
,
int
proxyPort
,
boolean
useCache
,
HttpURLConnection
httpuc
)
throws
IOException
{
return
HttpsClient
.
New
(
sf
,
url
,
hv
,
proxyHost
,
proxyPort
,
useCache
,
-
1
);
return
HttpsClient
.
New
(
sf
,
url
,
hv
,
proxyHost
,
proxyPort
,
useCache
,
-
1
,
httpuc
);
}
static
HttpClient
New
(
SSLSocketFactory
sf
,
URL
url
,
HostnameVerifier
hv
,
String
proxyHost
,
int
proxyPort
,
boolean
useCache
,
int
connectTimeout
)
int
connectTimeout
,
HttpURLConnection
httpuc
)
throws
IOException
{
return
HttpsClient
.
New
(
sf
,
url
,
hv
,
(
proxyHost
==
null
?
null
:
HttpsClient
.
newHttpProxy
(
proxyHost
,
proxyPort
)),
useCache
,
connectTimeout
);
useCache
,
connectTimeout
,
httpuc
);
}
static
HttpClient
New
(
SSLSocketFactory
sf
,
URL
url
,
HostnameVerifier
hv
,
Proxy
p
,
boolean
useCache
,
int
connectTimeout
)
throws
IOException
{
int
connectTimeout
,
HttpURLConnection
httpuc
)
throws
IOException
{
if
(
p
==
null
)
{
p
=
Proxy
.
NO_PROXY
;
}
HttpsClient
ret
=
null
;
if
(
useCache
)
{
/* see if one's already around */
ret
=
(
HttpsClient
)
kac
.
get
(
url
,
sf
);
if
(
ret
!=
null
&&
httpuc
!=
null
&&
httpuc
.
streaming
()
&&
httpuc
.
getRequestMethod
()
==
"POST"
)
{
if
(!
ret
.
available
())
ret
=
null
;
}
if
(
ret
!=
null
)
{
ret
.
cachedHttpClient
=
true
;
if
((
ret
.
proxy
!=
null
&&
ret
.
proxy
.
equals
(
p
))
||
(
ret
.
proxy
==
null
&&
p
==
null
))
{
synchronized
(
ret
)
{
ret
.
cachedHttpClient
=
true
;
assert
ret
.
inCache
;
ret
.
inCache
=
false
;
if
(
httpuc
!=
null
&&
ret
.
needsTunneling
())
httpuc
.
setTunnelState
(
TUNNELING
);
PlatformLogger
logger
=
HttpURLConnection
.
getHttpLogger
();
if
(
logger
.
isLoggable
(
PlatformLogger
.
FINEST
))
{
logger
.
finest
(
"KeepAlive stream retrieved from the cache, "
+
ret
);
}
}
}
else
{
// We cannot return this connection to the cache as it's
// KeepAliveTimeout will get reset. We simply close the connection.
// This should be fine as it is very rare that a connection
// to the same host will not use the same proxy.
synchronized
(
ret
)
{
ret
.
inCache
=
false
;
ret
.
closeServer
();
}
ret
=
null
;
}
}
}
if
(
ret
==
null
)
{
...
...
@@ -328,7 +372,11 @@ final class HttpsClient extends HttpClient
}
else
{
SecurityManager
security
=
System
.
getSecurityManager
();
if
(
security
!=
null
)
{
security
.
checkConnect
(
url
.
getHost
(),
url
.
getPort
());
if
(
ret
.
proxy
==
Proxy
.
NO_PROXY
||
ret
.
proxy
==
null
)
{
security
.
checkConnect
(
InetAddress
.
getByName
(
url
.
getHost
()).
getHostAddress
(),
url
.
getPort
());
}
else
{
security
.
checkConnect
(
url
.
getHost
(),
url
.
getPort
());
}
}
ret
.
url
=
url
;
}
...
...
@@ -607,6 +655,11 @@ final class HttpsClient extends HttpClient
@Override
protected
void
putInKeepAliveCache
()
{
if
(
inCache
)
{
assert
false
:
"Duplicate put to keep alive cache"
;
return
;
}
inCache
=
true
;
kac
.
put
(
url
,
sslSocketFactory
,
this
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录