-
Notifications
You must be signed in to change notification settings - Fork 5.9k
8170305: URLConnection doesn't handle HTTP/1.1 1xx (informational) messages #10229
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 jpai! A progress list of the required criteria for merging this PR into |
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.
LGTM globally. We're not supposed to receive 101 if we didn't ask for an upgrade (and we never should), but what happens if we still receive 101?
It could be beneficial to add that to your test as well.
…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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we explicitly wait for ProtocolException here, since it's what we're throwing?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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
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
HttpURLConnection
to 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 newHttpClient
API in #10169.A new test has been added to use the
HttpURLConnection
to reproduce the issue and verify the fix.tier1, tier2 and tier3 testing is in progress with this change.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10229/head:pull/10229
$ git checkout pull/10229
Update a local copy of the PR:
$ git checkout pull/10229
$ git pull https://git.openjdk.org/jdk pull/10229/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10229
View PR using the GUI difftool:
$ git pr show -t 10229
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10229.diff