-
Notifications
You must be signed in to change notification settings - Fork 239
8245245: WebSocket can lose the URL encoding of URI query parameters #1558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back Karm! A progress list of the required criteria for merging this PR into |
@Karm Please change the PR title to |
This backport pull request has now been updated with issue and summary from the original commit. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except for using getResponse().uri() and a few formatting issues in HandshakeUrlEncodingTest.java.
The change to use getResponse().uri() instead of getResponse().body() fixes a bug in tip, so can't be part of a backport. The thing to do is use the buggy code from the original commit in this backport, fix the problem in tip, then backport that fix to 19u, 17u, and 11u.
On formatting issues, future backports are easier if you match the original formatting as closely as possible. Looks like you're using and IDE that auto-formats.
At line 59:
import static java.lang.System.out;
import static java.net.http.HttpClient.Builder.NO_PROXY;
import static org.testng.Assert.*;
should be
import static java.net.http.HttpClient.Builder.NO_PROXY;
import static org.testng.Assert.*;
import static java.lang.System.out;
to more closely follow the original. In fact, if all the test uses is assertEquals, assertNotNull, and fail, just use the original commit code.
Indent/format the same as the original commit: lines 85-88, 89-92, 106-108, 111, 115, 133-135, 137, 141-146, 153-158, 174-176, 188-190, and missing blank line after 196. Might have missed somthing, but you get the idea.
@phohensee Thank you for the review. Ad formatting: Ack. Will do. Ad
Oh...I see. So the fact that the body is returned even though there was a failure is a bug, not a feature/desirable chage? I will browse the Jira and check the spec to make sure I am not bending the test to a faulty implementation then. Cheers |
Even if you discover a discrepancy, this would need to get fixed in JDK head first and then backported. Please keep that in mind. |
Helo, @phohensee, I changed the behavior of the test in the tip (HEAD), so as I can then backport it along the JDK-8245245 patch to 19u, 17u, and 11u. @jerboaa If I am reading the spec right, there is IMHO no need to change the behavior of the implementation. |
@jerboaa I realized the patch is already backported to JDK 19 and JDK 17. So it's just JDK 11 I'd like to backport JDK-8245245 to. And IIUC, the change in openjdk/jdk#11486 needed for JDK 11 will need backporting to JDK 19, JDK 17 too. |
Yes. |
FWIW, since https://bugs.openjdk.org/browse/JDK-8240666 is not in 11u, it would be acceptable to alter the test to account for this. A comment in the test could explain that. I don't think backporting JDK-8240666 would be appropriate (behaviour change) and it looks like getting the test change (account for the optional body) in JDK head might not be wanted. |
It is important that the test checks the URI received by the server, and that's probably why the body was used here. The server writes the URI it receives in the response body. This provides an end-to-end check that what was received is what we expected to send. Note that the server doesn't actually supports WebSocket and that's why it always replies with 400. |
Hello @dfuch, @jerboaa, @phohensee, @jaikiran I'd like this tets change to go forward: openjdk/jdk#11486 When that test change is integrated, I'd initiate its backport. Close this pr (#1558) and open a new one, that would just cleanly add JDK-8245245... I hope that is all right process wise. |
Thanks for double checking. In that case I believed you're covered, I personally have no objection in that case. I mostly commented because I don't think there's a bug in the original test. It just uses a different method to check for success. As for approval I'll defer to the JDK 11 maintainers. |
Hello @dfuch, @phohensee, With jdk/pull/11486 merged, I would kindly ask for a review of this backport to JDK11u.
thx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use /issue add JDK-8298588
as the test now contains those changes too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm with Severin's recommendations.
|
@Karm This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 40 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@phohensee, @jerboaa) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/issue add JDK-8298588 |
test/jdk/java/net/httpclient/websocket/HandshakeUrlEncodingTest.java
Outdated
Show resolved
Hide resolved
@Karm Thanks for contributing this backport to JDK 11 Updates. This looks good to me. As @jerboaa mentioned, the next step would be to add the fix request label and information to the JBS bug. I'd have one further request: Can you please backport your fix for JDK-8298588 to JDK 20 and JDK17 that we don't miss it out there. For JDK20, you can use the "/backport jdk20" comment on the commit in head. If the backport is clean, which I assume, you can right away integrate as it complies to the RDP1 rules (testfix). For jdk17u-dev, you'll need a PR and maintainer approval by labeling |
I think that's only available for committers. Just FYI. |
It is. I tried that the other day: openjdk/jdk@c07ce7e#commitcomment-91811154 |
OK, let me try to trigger the backports for you, see here... |
Thanks, lemme process it today. |
Hello, @jerboaa, This is the JBS text proposal, formatted for JIRA:
Edit, short version:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems OK to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm.
Tagged JDK-8298588. Commit pending jdk11u-fix-yes on JDk-8245245 and JDK-8298588. |
Hi @Karm, |
THX @RealCLanger |
@GoeLin Ack. Will do. My own thinking is along the lines that it is a well isolated change in a very comprehensible part of code, it aligns with the spec and it does not bring any surprising behavior when compared to some popular WebSocket client libs used with JDK 11, as noted in #1558 (comment). If there is code out there workarounding it, it's likely based on a string substitution and will turn to no-op now. I will try to be more eloquent about risks of particular backports in the it in future. |
Hi @Karm, I already did the backports, they are already integrated. You can close your PRs... 😄 |
@RealCLanger, Oh, I see :-D Sorry for the noise. |
@Karm, please add /integrate and I'll sponsor. |
/integrate |
THX @phohensee : ) |
/sponsor |
Going to push as commit ce10688.
Your commit was automatically rebased without conflicts. |
@phohensee @Karm Pushed as commit ce10688. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Proposes to backport JDK-8245245.
The backport is clean as far as the actual
OpeningHandshake.java
goes. The test needed a little tweak so as to compile withSimpleSSLContext
and also to handle the fact that the erroneous response does not bring a response body.The test passes with the patch, fails without it.
In addition to that, I compiled and executed the original
WebSocketTest.java
reproducer found on JDK-8245245 JIRA.Unpatched Temurin-11.0.17+8 ❌
Patched jdk11u ✔️
The patched version correctly leaves the latter part of the query param encoded.
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev pull/1558/head:pull/1558
$ git checkout pull/1558
Update a local copy of the PR:
$ git checkout pull/1558
$ git pull https://git.openjdk.org/jdk11u-dev pull/1558/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1558
View PR using the GUI difftool:
$ git pr show -t 1558
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/1558.diff