RFR: 8355572: Support HTTP Range requests in Simple Web Server [v6]
Peyang
duke at openjdk.org
Tue Nov 4 14:08:25 UTC 2025
On Mon, 3 Nov 2025 15:58:37 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> I implemented a check that validates whether the ranges are in ascendnig order and non-overlapping, returning an error if they are not.
>> However, I have some concerns: this restriction might be too strict.
>>
>> Instead of outright rejecting requests with overlapping or unsorted ranges, what if the server simply combines overlapping ranges and sorts them before returning?
>> According to [RFC 7233 §15.3.7.2](https://www.rfc-editor.org/rfc/rfc9110.html#section-15.3.7.2-4):
>>> When multiple ranges are requested, a server **MAY** coalesce any of the ranges that overlap, or that are separated by a gap that is smaller than the overhead of sending multiple parts, regardless of the order in which the corresponding range-spec appeared in the received [Range](https://www.rfc-editor.org/rfc/rfc9110.html#field.range) header field.
>>
>> In other words, rather than strictly validating and rejecting, we could treat this as an efficiency optimization on the server side. I think this approach would be more practical. I’d like to hear your thoughts on this.
>
> That would be fine too.
I updated the implementation to merge overlapping or unsorted ranges and sort them before returning, instead of rejecting.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28021#discussion_r2490654650
More information about the net-dev
mailing list