Closed
Description
HttpURLConnection will silently retry DELETE
requests. This behavior is similar to other existing JDK bugs (JDK-6382788, JDK-6427251). google-http-java-client already contains a workaround (NetHttpRequest.java#L108-L112) for those requests which have a body, but does not account for DELETE
with an empty body.
For Google Cloud Storage, while developing a conformance test suite for retry handling I ran into this bug and will submit a fix.
Environment details
- NetHttp
- OS type and version: Debian Linux
- Java version:
openjdk version "1.8.0_292" OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10) OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)
- google-http-client version(s):
1.40.0
and older
Steps to reproduce
- start a "server" which closes the connection without sending a response
socat tcp4-listen:8080,fork,reuseaddr system:"sleep 1"\!\!stdout
- run the following code and observe two requests in the server output
URL url = new URL("http://localhost:8080"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("DELETE"); conn.getResponseCode();
Code example
See rerpo step 3
Stack trace
No relevant stack trace