On Thu, 19 Feb 2026 16:12:51 GMT, Daisuke Yamazaki <[email protected]> wrote:

>> Hi all,
>> 
>> [JEP 408](https://openjdk.org/jeps/408) introduced the Simple Web Server in 
>> Java 18, providing a minimal webserver for serving static files over HTTP.
>> 
>> [RFC 9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-range-requests) 
>> defines "Range Requests" as an optional feature that allows clients to 
>> request a subset of a resource's content. Supporting Range requests in the 
>> context of JDK's Simple Web Server means enabling the server to serve only 
>> the requested portion of a static file.
>> 
>> This change contains:
>> 
>> 1. Enhances `sun.net.httpserver.simpleserver.FileServerHandler` in the 
>> `jdk.httpserver` module to support `Range` and `If-Range` headers.
>> 2. Calculates an `ETag` for each resource based on its last-modified date 
>> and file size and sends it to the client on demand for use with the 
>> `If-Range` header.
>> 3. Returns the `Accept-Ranges` header for all file retrievals, and 
>> `Content-Range` when a client requests a specific range.
>> 4. Adds a new constant `HTTP_RANGE_NOT_SATISFIABLE` to the `Codes` class to 
>> indicate invalid ranges.
>> 5. Returns `206 Partial Content` for valid ranges and `416 Range Not 
>> Satisfiable` for invalid ranges.
>> 6. Includes corresponding tests to verify correct behavior.
>> 
>> This enhancement was motivated by recent discussions on the net-dev mailing 
>> list, which requested support for Range requests along with example use 
>> cases: https://mail.openjdk.org/pipermail/net-dev/2025-April/026364.html
>> It was also discussed briefly on the net-dev mailing list: 
>> https://mail.openjdk.org/pipermail/net-dev/2025-October/028586.html
>> 
>> ---
>> 
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai)
>
> Daisuke Yamazaki has updated the pull request with a new target base due to a 
> merge or a rebase. The pull request now contains 33 commits:
> 
>  - Update copyright year to 2026 in test files
>  - Changed the test case implementation from TestNG to JUnit
>  - Merge remote-tracking branch 'upstream/master' into 
> 8355572-support-http-range-header
>    
>    # Conflicts:
>    #  test/jdk/com/sun/net/httpserver/simpleserver/FileServerHandlerTest.java
>    #  test/jdk/com/sun/net/httpserver/simpleserver/SimpleFileServerTest.java
>  - Merge branch 'master' into 8355572-support-http-range-header
>  - Fix HTTP Range header test case for invalid range format
>  - Add test case for duplicate and overlapping HTTP Range headers
>    
>    Co-authored-by: Daniel Fuchs <[email protected]>
>  - Replace IOException with EOFException for unexpected EOF in 
> FileServerHandler
>  - Throw IOException on unexpected EOF while reading file in FileServerHandler
>  - Implement range normalization for overlapping and contiguous HTTP Range 
> headers
>  - Add additional test cases for invalid HTTP Range header formats
>  - ... and 23 more: https://git.openjdk.org/jdk/compare/bea48b54...14ba03f1

Would someone kindly be available to review this PR when they have a moment?

Additionally, does anyone know how we might be able to remove the warning 
related to AI usage, or is there an established approach for handling it 
properly?

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

PR Comment: https://git.openjdk.org/jdk/pull/28021#issuecomment-4335036707

Reply via email to