On Fri, 15 Oct 2021 08:49:20 GMT, Evan Whelan <ewhe...@openjdk.org> wrote:
> Hi, > > Please review my fix for JDK-8274779 which changes how HttpClient and > HttpsClient checks for equality when comparing request methods. > > When `HttpURLConnection.setRequestMethod` is passed `new String("POST")` > rather than the "POST" String literal, the old behaviour resulted in broken > HttpClients being reused from the `KeepAliveCache`. > > This is because a call to `HttpClient.available()` was never reachable due to > identity equality being used instead of logical equality. > > The test case uses an injected KeepAliveCache, to which we put a HttpClient > that is unavailable. By comparing the initial HttpClient's `connectTimeout` > value to the "cached" client's connectTimeout (1234 vs 4321 respectively) we > can assert that these values should never be equal as a new HttpClient should > be created in cases where we can no longer use the cached one. > > All CI testing is green for this fix. > > Kind regards, > Evan This pull request has now been integrated. Changeset: 45ce06c9 Author: Evan Whelan <ewhe...@openjdk.org> Committer: Sean Coffey <coff...@openjdk.org> URL: https://git.openjdk.java.net/jdk/commit/45ce06c9f3e9bee7d4bda313c38f0f0e8786a4db Stats: 177 lines in 4 files changed: 175 ins; 0 del; 2 mod 8274779: HttpURLConnection: HttpClient and HttpsClient incorrectly check request method when set to POST Reviewed-by: dfuchs, coffeys, vtewari, michaelm ------------- PR: https://git.openjdk.java.net/jdk/pull/5964