RFR: 8054022: HttpURLConnection timeouts with Expect: 100-Continue and no chunking

Darragh Clarke duke at openjdk.org
Mon Apr 24 10:08:09 UTC 2023


On Tue, 4 Apr 2023 17:02:08 GMT, Darragh Clarke <duke at openjdk.org> wrote:

> Currently it is possible for `HttpURLConnection` with the `Expect: 100-Continue` header to timeout awaiting for a server response. According to [RFC-7231](https://www.rfc-editor.org/rfc/rfc7231#section-5.1.1) a client `SHOULD NOT wait for an indefinite period before sending the message body`.
> 
> This PR changes the existing `expect100Continue` method to wait for a maximum of 5 seconds for a server response, this will be shorter if a timeout is set. If no response is received, the message is sent regardless.
> 
> Tests have been added to account for different scenarios that currently timeout, and the changes have been tested against tiers 1,2 and 3.

Sorry for the delay in responding to the feedback, I was sidetracked on some other tasks then had an intermittent failure when I was adding the new fixed Length tests here.

I've added 3 tests to cover fixed length, tried to cut down some duplication by creating a shared `createConnection` method and cut down some of the server code.

Let me know if there are any other changes that should be made.

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

PR Comment: https://git.openjdk.org/jdk/pull/13330#issuecomment-1519829762


More information about the net-dev mailing list