RFR: 8303965: java.net.http.HttpClient should reset the stream if response headers contain malformed header fields [v3]

Daniel Fuchs dfuchs at openjdk.org
Mon Mar 13 11:09:03 UTC 2023


> 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](https://www.rfc-editor.org/rfc/rfc9113#HttpHeaders)).
> [...]
> Malformed requests or responses that are detected MUST be treated as a [stream error](https://www.rfc-editor.org/rfc/rfc9113#StreamErrorHandler) ([Section 5.4.2](https://www.rfc-editor.org/rfc/rfc9113#StreamErrorHandler)) of type [PROTOCOL_ERROR](https://www.rfc-editor.org/rfc/rfc9113#PROTOCOL_ERROR).
> 
> The current behavior is to close the connection with protocol error. This change makes it reset the stream instead.

Daniel Fuchs has updated the pull request incrementally with two additional commits since the last revision:

 - Update src/java.net.http/share/classes/jdk/internal/net/http/common/ValidatingHeadersConsumer.java
   
   Refer to RFC 9113
 - Update src/java.net.http/share/classes/jdk/internal/net/http/Stream.java
   
   Refer to RFC 9113

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/12976/files
  - new: https://git.openjdk.org/jdk/pull/12976/files/101dbc64..92d5eb6c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12976&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12976&range=01-02

  Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/12976.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12976/head:pull/12976

PR: https://git.openjdk.org/jdk/pull/12976


More information about the net-dev mailing list