Re: RFR: 8283544: HttpClient GET method adds Content-Length: 0 header [v5]

2022-04-07 Thread Conor Cleary
> **Issue**
> When using the `HttpClient.send()` to send a GET request created using the 
> `HttpRequest.newBuilder()`, a `Content-length: 0` header is set. This 
> behaviour causes issues with many services as a body related header is 
> usually not expected to be included with a GET request. 
> 
> **Solution**
> `Http1Request.java` was modified so that when the request method is a GET, a 
> `Content-length` header is not added to the request. However, if a developer 
> chooses to include a body in a GET request (though it is generally considered 
> bad practice), a `Content-length` header with the appropriate value will be 
> added.

Conor Cleary has updated the pull request incrementally with one additional 
commit since the last revision:

  8283544: Updated URI creation

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8017/files
  - new: https://git.openjdk.java.net/jdk/pull/8017/files/92d5309a..c1ef7d29

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=8017=04
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=8017=03-04

  Stats: 18 lines in 1 file changed: 7 ins; 0 del; 11 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8017.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8017/head:pull/8017

PR: https://git.openjdk.java.net/jdk/pull/8017


Integrated: JDK-8284353 : Update java/net and sun/net/www tests to eliminate dependency on sun.net.www.MessageHeader

2022-04-07 Thread Mahendra Chhipa
On Tue, 5 Apr 2022 10:27:54 GMT, Mahendra Chhipa  wrote:

> Updated java/net and sun/net/www tests to remove dependency on 
> sun.net.www.MessageHeader.

This pull request has now been integrated.

Changeset: ec73c61d
Author:Mahendra Chhipa 
Committer: Daniel Fuchs 
URL:   
https://git.openjdk.java.net/jdk/commit/ec73c61d8fe5de15a42fc14aaf8ebe3ac9ffcae5
Stats: 104 lines in 12 files changed: 40 ins; 6 del; 58 mod

8284353: Update java/net and sun/net/www tests to eliminate dependency on 
sun.net.www.MessageHeader

Reviewed-by: dfuchs

-

PR: https://git.openjdk.java.net/jdk/pull/8105


Integrated: 8263031: HttpClient throws Exception if it receives a Push Promise that is too large

2022-04-07 Thread Conor Cleary
On Fri, 4 Mar 2022 14:42:40 GMT, Conor Cleary  wrote:

> **Problem**
> When a Continuation Frame is received by the httpclient using HTTP/2 after a 
> Push Promise frame (can happen if the amount of headers to be sent in a 
> single Push Promise frame exceeds the maximum frame size, so a Continuation 
> frame is required), the following exception occurs:
> 
> 
> java.io.IOException: no statuscode in response
> at 
> java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:565)
> at 
> java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:119)
> ...
> 
> This exception occurs because there is no existing flow in 
> `jdk/internal/net/http/Http2Connection.java` which accounts for the case 
> where a PushPromiseFrame is received with the END_HEADERS flag set to 0x0. 
> When this occurs, the only acceptable frame/s (as multiple continuations are 
> also acceptable) that can be received by the client on the same stream is a 
> continuation frame.
> 
> **Fix**
> To ensure correct behavior, the following changes were made to 
> `jdk/internal/net/http/Http2Connection.java`.
> 
> - The existing method `handlePushPromise()` was modified so that if the 
> END_HEADERS flag is _unset_ (flags equal to 0x0), then a record used to track 
> the state of the Push Promise containing a shared `HeaderDecoder` and the 
> received `PushPromiseFrame` is initialised.
> - When the subsequent `ContinuationFrame` is received in `processFrame()`, 
> the method `handlePushContinuation()` is called instead of the default flow 
> resulting in `stream.incoming(frame)` being called (the source of the 
> incorrect behaviour originally).
> - In `handlePushContinuation()`, the shared decoder is used to decode the 
> received `ContinuationFrame` headers and if the `END_HEADERS` flag is set 
> (flags equal to 0x4), the `HttpHeaders` object for the Push Promise as a 
> whole is constructed which serves to combine the headers from both the 
> `PushPromiseFrame` and the `ContinuationFrame`.
> 
> A regression test was included which verifies that the exception is not 
> thrown and that the headers arrive correctly.

This pull request has now been integrated.

Changeset: 4d2cd26a
Author:Conor Cleary 
Committer: Daniel Fuchs 
URL:   
https://git.openjdk.java.net/jdk/commit/4d2cd26ab5092ad0a169e4239164a869a4255bd3
Stats: 439 lines in 4 files changed: 397 ins; 19 del; 23 mod

8263031: HttpClient throws Exception if it receives a Push Promise that is too 
large

Reviewed-by: dfuchs

-

PR: https://git.openjdk.java.net/jdk/pull/7696