On Fri, 19 Apr 2024 10:48:41 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:

>> 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...)

Before doing that, you might want to check the HTTPS case. As far as I can 
tell, we don't do any buffering when SSL is in use.

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

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

Reply via email to