RFR: 6968351: httpserver clashes with delayed TCP ACKs for low Content-Length [v17]

robert engels duke at openjdk.org
Thu Apr 25 14:43:38 UTC 2024


On Thu, 25 Apr 2024 13:36:53 GMT, robert engels <duke at openjdk.org> wrote:

>>> I think a better solution would be to add a constant to the api class - rather than adding comments everywhere. E.g NO_CONTENT=-1 and UNLIMITED_CONTENT=0 or INDETERMINENT_CONTENT=0, or CHUNKED_CONTENT=0
>> 
>> That's not a bad idea. I am doing a small update to the API under another bug id and I might include that in it. I kind of agree that adding comments might be overkill. We could probably update a lot of the tests mechanically to use these symbolic names afterwards.
>
> I’m on mobile now so I haven’t looked at the api - but I think adding default methods like
> 
> sendResponseHeadersNoContent(int code)
> 
> and OutputStream sendResponseHeadersChunked(int code)
> 
> possibly sendResponeWithContent(int code, byte[] data) would also be helpful and cut down to n a lot of usage problems. 
> 
> would also make the api easier to use.

I am more than willing to work on an API change PR to add these methods. It is an abstract class, so they could collide with existing code, but I am guessing it is a trivial fix if it does, and it would break at compile time not runtime.

adding protected constants to the HttpExchange abstract class seems trivially safe.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18667#discussion_r1579595951


More information about the net-dev mailing list