RFR: 7026262: HttpServer: improve handling of finished HTTP exchanges [v2]

Daniel Jeliński djelinski at openjdk.org
Fri Mar 24 11:04:30 UTC 2023


On Fri, 24 Mar 2023 10:16:45 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> `sendResponseStream` could close the stream when called with length = -1; the output stream is always fixed length in that case. I'd need to modify this class to accept zero-length writes even when closed, but I think there's a precedent for that already. Will look into it.
>
> That was just a suggestion - I was a bit bothered with the hidden interaction between FixedLengthOutputStream and sendResponseHeaders here, where FixedLengthOutputStream has to trust that sendResponseHeaders has sent the event. It looked strange. Maybe there are other possibilities - like e.g a ZeroLengthOutputStream :-)

I changed `sendResponseHeaders` to close the exchange, and I like the result much better. 
`ExceptionKeepAlive` test no longer needs to explicitly close the request body before sending the response - exchange's `close` takes care of that.
Let me know what you think.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13157#discussion_r1147427578


More information about the net-dev mailing list