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

Peyang duke at openjdk.org
Tue Nov 4 13:40:39 UTC 2025


On Mon, 3 Nov 2025 10:10:50 GMT, Michael McMahon <michaelm at openjdk.org> wrote:

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

Thanks for the clarification.
I've updated the implementation accordingly.

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

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


More information about the net-dev mailing list