-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
8299018: java/net/httpclient/HttpsTunnelAuthTest.java fails with java.io.IOException: HTTP/1.1 header parser received no bytes #11717
Conversation
👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into |
Webrevs
|
Co-authored-by: Daniel Jelinski <djelinski1@gmail.com>
Good catch. Thanks @djelinski |
@@ -458,11 +458,14 @@ private boolean shouldCloseAfter407(List<String> headers) throws IOException { | |||
try { | |||
n = Integer.parseInt(cl); |
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.
Hello Daniel, is it expected that the content-length
header will always be present and if it isn't then the ProxyServer
is expected to close the connection?
In its current form (even without the changes in this PR), if the content-length
header is missing, this block will run into a NumberFormatException
leading to the connection closure. Is that OK?
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.
The idea is that the connection can be reused only if the ProxyServer knows how many bytes it should read from the connection to get to the next request. Otherwise the connection will be closed. So if using chunked encoding or if no content-length is given the ProxyServer will simply close the connection. Maybe a smarter implementation could deal with chunked encoding and also look at the request method and accept that no content length means 0 in case of HEAD or GET - but that's not part of this fix.
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.
Actually - maybe I should go on and make the changes wrt GET and HEAD. The ProxyServer seems to have some code for this but it looks buggy.
Could you also modify the ProxyServer to send a |
Good idea. |
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.
} | ||
return true; // should close | ||
} | ||
if (n > 0 || n < -1) { |
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.
this part can be removed; we don't need any special handling for content-length: -1
var cmdline = headers.get(0); | ||
int m = cmdline.indexOf(' '); | ||
var method = (m > 0) ? cmdline.substring(0, m) : null; | ||
var nobody = List.of("GET", "HEAD"); |
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 think we can include CONNECT
in this list
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 leave a failed CONNECT connection open? I'm not sure. CONNECT are handled separately on the client side 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.
Looks fine to me.
@dfuch 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 10 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit e5edb10.
Your commit was automatically rebased without conflicts. |
Please find here a trivial fix for a test issue in the HttpClient test's ProxyServer.
The ProxyServer has a bad printf that throws an IllegalFormatConversionException, which causes the proxy to close the connection after sending a 407 request. Depending on timing, the client might attempt to reuse the closed (or soon to be closed) connection for sending authentication, which then gets the next POST request to fail.
This failure is rare and intermittent (the client usually gets the close notification before it reuses the connection), but sometimes it doesn't.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11717/head:pull/11717
$ git checkout pull/11717
Update a local copy of the PR:
$ git checkout pull/11717
$ git pull https://git.openjdk.org/jdk pull/11717/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 11717
View PR using the GUI difftool:
$ git pr show -t 11717
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11717.diff