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

Darragh Clarke duke at openjdk.org
Wed Apr 5 10:14:21 UTC 2023


On Wed, 5 Apr 2023 05:05:03 GMT, Justin Lu <jlu 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.
>
> test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java line 193:
> 
>> 191:         control.write100ContinueTwice = false;
>> 192: 
>> 193:         HttpURLConnection connection = (HttpURLConnection) url.openConnection();
> 
> Hi Darragh,
> 
> It looks like the tests share a lot of similar code, unless there is a reason not to, could they not share a similar function to reduce code duplication?

Hey, thanks for pointing that out, I'll try and reduce some of the duplication

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13330#discussion_r1158312342


More information about the net-dev mailing list