RFR: 8355572: Support HTTP Range requests in Simple Web Server [v6]

Daniel Fuchs dfuchs at openjdk.org
Fri Oct 31 14:56:06 UTC 2025


On Fri, 31 Oct 2025 13:41:47 GMT, Michael McMahon <michaelm at openjdk.org> wrote:

>> Peyang has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add documentation for HTTP range requests support in SimpleFileServer
>
> src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/FileServerHandler.java line 399:
> 
>> 397:                     int len = raf.read(buffer, 0, (int) Math.min(buffer.length, bytesToWrite));
>> 398:                     if (len == -1) {
>> 399:                         break;  // EOF
> 
> Is this not an error situation, if we reach EOF and have only partially returned the requested range?

Good point. But we have already sent the status code. I guess we should throw IOException in this case, so that the ServerImpl closes the connection, ensuring that the client notices that the response was not entirely fulfilled?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28021#discussion_r2481693671


More information about the net-dev mailing list