8170305: URLConnection doesn't handle HTTP/1.1 1xx (informational) messages#10229
8170305: URLConnection doesn't handle HTTP/1.1 1xx (informational) messages#10229jaikiran wants to merge 6 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back jpai! A progress list of the required criteria for merging this PR into |
Webrevs
|
…ttpURLConnection doesn't ask for a connection upgrade
|
Hello Daniel, I've triggered tier1, tier2 and tier3 to make sure this doesn't cause any issues. |
|
I just tested the latest patch and the new test hangs for me. I can send you the stack trace to take a look. |
|
Hello Michael, I could reproduce the hang locally after a few attempts. This was a bug in the test server which I've now fixed in the updated version of the PR. What was happening was that the client upon seeing an unexpected 101 would close the connection and throw a (client side) IOException. The |
|
tier1, tier2, tier3 testing as well as testing of |
| System.out.println("Issuing request to " + requestURI); | ||
| final HttpURLConnection urlConnection = (HttpURLConnection) requestURI.toURL().openConnection(); | ||
| // we expect the request to fail because the server unexpectedly sends a 101 response | ||
| Assert.assertThrows(IOException.class, () -> urlConnection.getResponseCode()); |
There was a problem hiding this comment.
Should we explicitly wait for ProtocolException here, since it's what we're throwing?
There was a problem hiding this comment.
I initially thought about that, but since the API javadoc doesn't specifically talk about this sub-type of IOException, I decided it's perhaps better not to start expecting it. However, if it's OK for the test to rely on this (internal) knowledge then I'll go ahead and change it.
There was a problem hiding this comment.
Yes - this is not a conformance test, and ProtocolException is within the bounds. It's OK for a non-regression test to expect the specific subtype that the code change is throwing. My concern here is that the test could be passing if some other kind of errors occurred - like e.g. connect exception. Then we wouldn't be testing what we think we're testing.
There was a problem hiding this comment.
Thank you. I've now updated the test to expect ProtocolException. The test continues to pass with this change.
|
@jaikiran This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. 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 17 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. ➡️ To integrate this PR with the above commit message to the |
|
Thank you Daniel and Michael for the reviews. |
|
/integrate |
|
Going to push as commit 8bd79d3.
Your commit was automatically rebased without conflicts. |
|
Thanks - I'll test once the next build is out. Is this something that would be a candidate for backporting? |
|
Hello Julian,
This change is relatively straightforward and backporting should be OK. OpenJDK backports however are decided/managed by different team(s) and discussed in https://mail.openjdk.org/mailman/listinfo/jdk-updates-dev mailing list. The OpenJDK guide has more details on the backporting process https://openjdk.org/guide/#backporting |
|
Tested over at https://github.com/greenbytes/java-http-1xx-tests and found to be working; thanks!
So is the proposal that I should follow up over there? |
Thank you Julian for running those tests. Glad to hear it works now.
Yes, I suggest asking in that mailing list on how to get this backported. I would have given you a bit more precise instructions, but the last time I backported a change was way before the new bots based backporting was introduced, so I don't have more recent knowledge of backports. |
Can I please get a review of this change which proposes to fix https://bugs.openjdk.org/browse/JDK-8170305?
The commit in this PR changes the internal implementation of
HttpURLConnectionto ignore interim informational 1xx responses from server and continue to wait for the final response. This is a similar fix to what we did in the newHttpClientAPI in #10169.A new test has been added to use the
HttpURLConnectionto reproduce the issue and verify the fix.tier1, tier2 and tier3 testing is in progress with this change.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10229/head:pull/10229$ git checkout pull/10229Update a local copy of the PR:
$ git checkout pull/10229$ git pull https://git.openjdk.org/jdk pull/10229/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10229View PR using the GUI difftool:
$ git pr show -t 10229Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10229.diff