-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8303965: java.net.http.HttpClient should reset the stream if response headers contain malformed header fields #12976
Conversation
👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into |
Webrevs
|
HttpClient tests are stable and tier2 passed |
streamid, n, v); | ||
} | ||
} catch (UncheckedIOException uio) { | ||
// reset stream: From RFC 7540, section-8.1.2.6 |
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, should we instead refer to RFC-9113 (section 8.1.1) which obsoletes RFC-7540? In the context of this PR, the newer RFC continues to have the same expectations as that in RFC-7540.
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.
Right. Sorry for the oversight.
* @return the initial stream created during the upgrade. | ||
*/ | ||
@SuppressWarnings("unchecked") | ||
<T> Stream<T> getInitialStream() { |
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.
Given that this method returns and also updates the initial stream member field, the naming of this method is a bit odd. But I can't think of a better name, plus this is internal to the jdk.internal.net.http
package and also has a comment which explains what it does, so I think this name is fine.
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.
Maybe I could change the name to "retrieveInitialStream()"... Would that be better?
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, I don't have strong preference, retrieveInitialStream
sounds OK. It's also OK if you would want to continue with the current name.
import java.util.Set; | ||
|
||
/* | ||
* Checks RFC 7540 rules (relaxed) compliance regarding pseudo-headers. |
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.
Same here, should we use new RFC number?
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.
Done
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 change looks good to me. I just have a question about the RFC numbers in the comment, which I have asked inline.
@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 1 new commit 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 |
src/java.net.http/share/classes/jdk/internal/net/http/Stream.java
Outdated
Show resolved
Hide resolved
streamid, n, v); | ||
} | ||
} catch (UncheckedIOException uio) { | ||
// reset stream: From RFC 7540, section-8.1.2.6 |
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.
Right. Sorry for the oversight.
src/java.net.http/share/classes/jdk/internal/net/http/common/ValidatingHeadersConsumer.java
Outdated
Show resolved
Hide resolved
import java.util.Set; | ||
|
||
/* | ||
* Checks RFC 7540 rules (relaxed) compliance regarding pseudo-headers. |
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.
Done
…alidatingHeadersConsumer.java Refer to RFC 9113
/integrate |
According to RFC 9113:
A malformed request or response is one that is an otherwise valid sequence of HTTP/2 frames but is invalid due to the presence of extraneous frames, prohibited fields or pseudo-header fields, the absence of mandatory pseudo-header fields, the inclusion of uppercase field names, or invalid field names and/or values (in certain circumstances; see Section 8.2).
[...]
Malformed requests or responses that are detected MUST be treated as a stream error (Section 5.4.2) of type PROTOCOL_ERROR.
The current behavior is to close the connection with protocol error. This change makes it reset the stream instead.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12976/head:pull/12976
$ git checkout pull/12976
Update a local copy of the PR:
$ git checkout pull/12976
$ git pull https://git.openjdk.org/jdk pull/12976/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12976
View PR using the GUI difftool:
$ git pr show -t 12976
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12976.diff