mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8314978: Multiple server call from connection failing with expect100 in getOutputStream
Reviewed-by: dfuchs
This commit is contained in:
parent
dc4bc4f084
commit
460ebcd9cb
2 changed files with 268 additions and 0 deletions
|
@ -404,6 +404,10 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||
calls getInputStream after disconnect */
|
||||
private Exception rememberedException = null;
|
||||
|
||||
/* Remembered Exception, we will throw it again if somebody
|
||||
calls getOutputStream after disconnect or error */
|
||||
private Exception rememberedExceptionOut = null;
|
||||
|
||||
/* If we decide we want to reuse a client, we put it here */
|
||||
private HttpClient reuseClient = null;
|
||||
|
||||
|
@ -1431,6 +1435,14 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||
+ " if doOutput=false - call setDoOutput(true)");
|
||||
}
|
||||
|
||||
if (rememberedExceptionOut != null) {
|
||||
if (rememberedExceptionOut instanceof RuntimeException) {
|
||||
throw new RuntimeException(rememberedExceptionOut);
|
||||
} else {
|
||||
throw getChainedException((IOException) rememberedExceptionOut);
|
||||
}
|
||||
}
|
||||
|
||||
if (method.equals("GET")) {
|
||||
method = "POST"; // Backward compatibility
|
||||
}
|
||||
|
@ -1490,9 +1502,11 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||
int i = responseCode;
|
||||
disconnectInternal();
|
||||
responseCode = i;
|
||||
rememberedExceptionOut = e;
|
||||
throw e;
|
||||
} catch (RuntimeException | IOException e) {
|
||||
disconnectInternal();
|
||||
rememberedExceptionOut = e;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue