RFR: 8274779: HttpURLConnection: HttpClient and HttpsClient incorrectly check request method when set to POST [v6]
Evan Whelan
ewhelan at openjdk.java.net
Wed Oct 20 15:14:06 UTC 2021
> 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
Evan Whelan has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
Removed +open from jtreg modules
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/5964/files
- new: https://git.openjdk.java.net/jdk/pull/5964/files/f5b0d2d8..13257929
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5964&range=05
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5964&range=04-05
Stats: 0 lines in 0 files changed: 0 ins; 0 del; 0 mod
Patch: https://git.openjdk.java.net/jdk/pull/5964.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/5964/head:pull/5964
PR: https://git.openjdk.java.net/jdk/pull/5964
More information about the net-dev
mailing list