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

Michael McMahon michaelm at openjdk.org
Mon Nov 3 10:14:30 UTC 2025


On Fri, 31 Oct 2025 15:15:22 GMT, Peyang <duke at openjdk.org> wrote:

>> I'll have to check the RFC but it might be allowable to return a shorter range than was requested, but the actual range to be returned would have to have been specified in the `Content-Range` header. You would have to check the length of the file first. So, EOF wouldn't occur except in very unusual circumstances. Otherwise, yes throwing IOE would close the connection signaling the error.
>
> The `ranges` list in the arguments is constructed so that each range's end option does not exceed the file size: if a requested range goes beyond the file lengh, it is clamped accordingly.
> Therefore, I don't think any foundamental change is needed here.
> 
> We could add an `assert` (and a comment) to make this assumption explict, or possibly throw an IOE in case the file was truncated or modified during sending.

I definitely don't want code that allows a `Content-Range: bytes 1000-2000` to be written and treated as normal if the file hits EOF 10 bytes short. Even if the situation cannot arise due to higher level checks, I'd like to see IOE thrown rather than breaking from the loop.

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

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


More information about the net-dev mailing list