On Fri, 19 Apr 2024 09:03:36 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
>> fix bug JDK-B6968351 by avoiding flush after response headers > > src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java line > 210: > >> 208: this.rcode = rCode; >> 209: String statusLine = "HTTP/1.1 "+rCode+Code.msg(rCode)+"\r\n"; >> 210: ByteArrayOutputStream tmpout = new ByteArrayOutputStream(); > > Wouldn't it be better to continue using a BufferedOutputStream here? That > would put a limit on how much data would be buffered when writing the > headers, in case of long response headers. Forget I asked this. @djelinski pointed out this is necessary to avoid having to flush at line 281. But I see that at line 686 you replaced rawout with a BufferedOutputStream - so do we still need the temporary ByteArrayOutputStream? Can't we just write directly to `ros` (possibly assert ros instanceof BufferedOutputStream if we want to make sure...) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/18667#discussion_r1572188500