-
Bug
-
Resolution: Fixed
-
P2
-
5.0
-
b58
-
generic
-
generic
The fix for bug
5039967: Repeated authentication for each jar with multi-jar applet/client authentication only partially fixed the problem. There is one case that still fails.
I recorded an asyc close of socket by the gc calling MeteredStream.finalize() (see details in bug 5039967 description) that happens when the response body is empty.
Here's what my fix looked like:
750 String requestLine = requests.getKey(0);
751
752 if (cl == -1 && ((requestLine != null &&
753 (requestLine.startsWith("HEAD"))) ||
754 code == HttpURLConnection.HTTP_NOT_MODIFIED ||
755 code == HttpURLConnection.HTTP_NO_CONTENT)) {
756 cl = 0;
757 }
758
at one point, I didn't have cl == -1 in the if clause. I put it in later just to be "safe". well, it turns out that doing that is incorrect, because if the request is "HEAD", the content-length will be set to the same value as if it is a "GET" request, but the response body will be empty. So MeteredStream or KeepAliveStream could still be created when the connection is reused. When that stream goes out of scope and be GCed, the reused connection could be closed from underneath. if I remove the cl == -1 check, plugin tests will pass.
###@###.### 2004-06-23
5039967: Repeated authentication for each jar with multi-jar applet/client authentication only partially fixed the problem. There is one case that still fails.
I recorded an asyc close of socket by the gc calling MeteredStream.finalize() (see details in bug 5039967 description) that happens when the response body is empty.
Here's what my fix looked like:
750 String requestLine = requests.getKey(0);
751
752 if (cl == -1 && ((requestLine != null &&
753 (requestLine.startsWith("HEAD"))) ||
754 code == HttpURLConnection.HTTP_NOT_MODIFIED ||
755 code == HttpURLConnection.HTTP_NO_CONTENT)) {
756 cl = 0;
757 }
758
at one point, I didn't have cl == -1 in the if clause. I put it in later just to be "safe". well, it turns out that doing that is incorrect, because if the request is "HEAD", the content-length will be set to the same value as if it is a "GET" request, but the response body will be empty. So MeteredStream or KeepAliveStream could still be created when the connection is reused. When that stream goes out of scope and be GCed, the reused connection could be closed from underneath. if I remove the cl == -1 check, plugin tests will pass.
###@###.### 2004-06-23
- relates to
-
JDK-5039967 Repeated authentication for each jar with multi-jar applet/client authentication
-
- Resolved
-