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

Peyang duke at openjdk.org
Thu Oct 30 12:42:06 UTC 2025


On Thu, 30 Oct 2025 11:42:38 GMT, Florent Guillaume <duke at openjdk.org> wrote:

>> src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/FileServerHandler.java line 315:
>> 
>>> 313:     }
>>> 314: 
>>> 315:     private List<RangeEntry> parseRangeHeader(String rangeHeader, long fileSize) {
>> 
>> It would be good to add a comment block before this method (no need for javadoc-style, // is enough) to give an example of all the valid values for the `rangeHeader` string. That would help in asserting that the method body does what it is supposed to do, and it will make easier to maintain should a bug be discovered later on.
>
> Not a reviewer, but I'd go further: this kind of method should be directly unit tested (not indirectly through all the http layers), and full coverage ensured.

Thanks for your reviews.
Regarding adding comments to the method, I will make the corresponding changes.
As for the unit tests, it is indeed more reasonable to test this method directly rather than through the HTTP layer.
With that in mind, would it be okay to make this method package-private so that it can be called from the test code and properly unit tested?

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

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


More information about the net-dev mailing list