Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 538464b

Browse files
author
Yuri Nesterenko
committed
8238579: HttpsURLConnection drops the timeout and hangs forever in read
HttpsURLConnection drops the timeout and hangs forever in read Backport-of: ff8e7d4
1 parent a5c8624 commit 538464b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/java.base/share/classes/sun/net/www/protocol/https/AbstractDelegateHttpsURLConnection.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -87,10 +87,16 @@ public void setNewClient (URL url)
8787
*/
8888
public void setNewClient (URL url, boolean useCache)
8989
throws IOException {
90+
int readTimeout = getReadTimeout();
9091
http = HttpsClient.New (getSSLSocketFactory(),
9192
url,
9293
getHostnameVerifier(),
93-
useCache, this);
94+
null,
95+
-1,
96+
useCache,
97+
getConnectTimeout(),
98+
this);
99+
http.setReadTimeout(readTimeout);
94100
((HttpsClient)http).afterConnect();
95101
}
96102

@@ -132,10 +138,16 @@ protected void proxiedConnect(URL url, String proxyHost, int proxyPort,
132138
boolean useCache) throws IOException {
133139
if (connected)
134140
return;
141+
int readTimeout = getReadTimeout();
135142
http = HttpsClient.New (getSSLSocketFactory(),
136143
url,
137144
getHostnameVerifier(),
138-
proxyHost, proxyPort, useCache, this);
145+
proxyHost,
146+
proxyPort,
147+
useCache,
148+
getConnectTimeout(),
149+
this);
150+
http.setReadTimeout(readTimeout);
139151
connected = true;
140152
}
141153

0 commit comments

Comments
 (0)