-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
When I open a connection and use getOutputStream() with a fixed size first, it will redirect that connection correctly.
However, when I then use getInputStream() afterwards to read the server's response, I will get an HttpRetryException "cannot retry due to redirection, in streaming mode", generated from sun.net.www.protocol.http.HttpURLConnection.followRedirect0() as streaming() returns true in this case.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
In pseudo-code:
connection.setFixedLengthStreamingMode(size);
connection.setRequestProperty("Content-Type", "application/octet-stream");
connection.setDoOutput(true);
try (var output = connection.getOutputStream()) {
...
}
try (var input = connection.getInputStream()) {
...
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It reuses the existing connection without trying to redirect again (as it already did that successfully).
ACTUAL -
A HttpRetryException is thrown.
CUSTOMER SUBMITTED WORKAROUND :
Switch to Apache's HTTP implementation.
FREQUENCY : always
When I open a connection and use getOutputStream() with a fixed size first, it will redirect that connection correctly.
However, when I then use getInputStream() afterwards to read the server's response, I will get an HttpRetryException "cannot retry due to redirection, in streaming mode", generated from sun.net.www.protocol.http.HttpURLConnection.followRedirect0() as streaming() returns true in this case.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
In pseudo-code:
connection.setFixedLengthStreamingMode(size);
connection.setRequestProperty("Content-Type", "application/octet-stream");
connection.setDoOutput(true);
try (var output = connection.getOutputStream()) {
...
}
try (var input = connection.getInputStream()) {
...
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It reuses the existing connection without trying to redirect again (as it already did that successfully).
ACTUAL -
A HttpRetryException is thrown.
CUSTOMER SUBMITTED WORKAROUND :
Switch to Apache's HTTP implementation.
FREQUENCY : always